fsnotify.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Copyright (C) 2008 Red Hat, Inc., Eric Paris <[email protected]>
  4. */
  5. #include <linux/dcache.h>
  6. #include <linux/fs.h>
  7. #include <linux/gfp.h>
  8. #include <linux/init.h>
  9. #include <linux/module.h>
  10. #include <linux/mount.h>
  11. #include <linux/srcu.h>
  12. #include <linux/fsnotify_backend.h>
  13. #include "fsnotify.h"
  14. /*
  15. * Clear all of the marks on an inode when it is being evicted from core
  16. */
  17. void __fsnotify_inode_delete(struct inode *inode)
  18. {
  19. fsnotify_clear_marks_by_inode(inode);
  20. }
  21. EXPORT_SYMBOL_GPL(__fsnotify_inode_delete);
  22. void __fsnotify_vfsmount_delete(struct vfsmount *mnt)
  23. {
  24. fsnotify_clear_marks_by_mount(mnt);
  25. }
  26. /**
  27. * fsnotify_unmount_inodes - an sb is unmounting. handle any watched inodes.
  28. * @sb: superblock being unmounted.
  29. *
  30. * Called during unmount with no locks held, so needs to be safe against
  31. * concurrent modifiers. We temporarily drop sb->s_inode_list_lock and CAN block.
  32. */
  33. static void fsnotify_unmount_inodes(struct super_block *sb)
  34. {
  35. struct inode *inode, *iput_inode = NULL;
  36. spin_lock(&sb->s_inode_list_lock);
  37. list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
  38. /*
  39. * We cannot __iget() an inode in state I_FREEING,
  40. * I_WILL_FREE, or I_NEW which is fine because by that point
  41. * the inode cannot have any associated watches.
  42. */
  43. spin_lock(&inode->i_lock);
  44. if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) {
  45. spin_unlock(&inode->i_lock);
  46. continue;
  47. }
  48. /*
  49. * If i_count is zero, the inode cannot have any watches and
  50. * doing an __iget/iput with SB_ACTIVE clear would actually
  51. * evict all inodes with zero i_count from icache which is
  52. * unnecessarily violent and may in fact be illegal to do.
  53. * However, we should have been called /after/ evict_inodes
  54. * removed all zero refcount inodes, in any case. Test to
  55. * be sure.
  56. */
  57. if (!atomic_read(&inode->i_count)) {
  58. spin_unlock(&inode->i_lock);
  59. continue;
  60. }
  61. __iget(inode);
  62. spin_unlock(&inode->i_lock);
  63. spin_unlock(&sb->s_inode_list_lock);
  64. iput(iput_inode);
  65. /* for each watch, send FS_UNMOUNT and then remove it */
  66. fsnotify_inode(inode, FS_UNMOUNT);
  67. fsnotify_inode_delete(inode);
  68. iput_inode = inode;
  69. cond_resched();
  70. spin_lock(&sb->s_inode_list_lock);
  71. }
  72. spin_unlock(&sb->s_inode_list_lock);
  73. iput(iput_inode);
  74. }
  75. void fsnotify_sb_delete(struct super_block *sb)
  76. {
  77. fsnotify_unmount_inodes(sb);
  78. fsnotify_clear_marks_by_sb(sb);
  79. /* Wait for outstanding object references from connectors */
  80. wait_var_event(&sb->s_fsnotify_connectors,
  81. !atomic_long_read(&sb->s_fsnotify_connectors));
  82. }
  83. /*
  84. * Given an inode, first check if we care what happens to our children. Inotify
  85. * and dnotify both tell their parents about events. If we care about any event
  86. * on a child we run all of our children and set a dentry flag saying that the
  87. * parent cares. Thus when an event happens on a child it can quickly tell
  88. * if there is a need to find a parent and send the event to the parent.
  89. */
  90. void __fsnotify_update_child_dentry_flags(struct inode *inode)
  91. {
  92. struct dentry *alias;
  93. int watched;
  94. if (!S_ISDIR(inode->i_mode))
  95. return;
  96. /* determine if the children should tell inode about their events */
  97. watched = fsnotify_inode_watches_children(inode);
  98. spin_lock(&inode->i_lock);
  99. /* run all of the dentries associated with this inode. Since this is a
  100. * directory, there damn well better only be one item on this list */
  101. hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) {
  102. struct dentry *child;
  103. /* run all of the children of the original inode and fix their
  104. * d_flags to indicate parental interest (their parent is the
  105. * original inode) */
  106. spin_lock(&alias->d_lock);
  107. list_for_each_entry(child, &alias->d_subdirs, d_child) {
  108. if (!child->d_inode)
  109. continue;
  110. spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED);
  111. if (watched)
  112. child->d_flags |= DCACHE_FSNOTIFY_PARENT_WATCHED;
  113. else
  114. child->d_flags &= ~DCACHE_FSNOTIFY_PARENT_WATCHED;
  115. spin_unlock(&child->d_lock);
  116. }
  117. spin_unlock(&alias->d_lock);
  118. }
  119. spin_unlock(&inode->i_lock);
  120. }
  121. /* Are inode/sb/mount interested in parent and name info with this event? */
  122. static bool fsnotify_event_needs_parent(struct inode *inode, struct mount *mnt,
  123. __u32 mask)
  124. {
  125. __u32 marks_mask = 0;
  126. /* We only send parent/name to inode/sb/mount for events on non-dir */
  127. if (mask & FS_ISDIR)
  128. return false;
  129. /*
  130. * All events that are possible on child can also may be reported with
  131. * parent/name info to inode/sb/mount. Otherwise, a watching parent
  132. * could result in events reported with unexpected name info to sb/mount.
  133. */
  134. BUILD_BUG_ON(FS_EVENTS_POSS_ON_CHILD & ~FS_EVENTS_POSS_TO_PARENT);
  135. /* Did either inode/sb/mount subscribe for events with parent/name? */
  136. marks_mask |= fsnotify_parent_needed_mask(inode->i_fsnotify_mask);
  137. marks_mask |= fsnotify_parent_needed_mask(inode->i_sb->s_fsnotify_mask);
  138. if (mnt)
  139. marks_mask |= fsnotify_parent_needed_mask(mnt->mnt_fsnotify_mask);
  140. /* Did they subscribe for this event with parent/name info? */
  141. return mask & marks_mask;
  142. }
  143. /*
  144. * Notify this dentry's parent about a child's events with child name info
  145. * if parent is watching or if inode/sb/mount are interested in events with
  146. * parent and name info.
  147. *
  148. * Notify only the child without name info if parent is not watching and
  149. * inode/sb/mount are not interested in events with parent and name info.
  150. */
  151. int __fsnotify_parent(struct dentry *dentry, __u32 mask, const void *data,
  152. int data_type)
  153. {
  154. const struct path *path = fsnotify_data_path(data, data_type);
  155. struct mount *mnt = path ? real_mount(path->mnt) : NULL;
  156. struct inode *inode = d_inode(dentry);
  157. struct dentry *parent;
  158. bool parent_watched = dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED;
  159. bool parent_needed, parent_interested;
  160. __u32 p_mask;
  161. struct inode *p_inode = NULL;
  162. struct name_snapshot name;
  163. struct qstr *file_name = NULL;
  164. int ret = 0;
  165. /*
  166. * Do inode/sb/mount care about parent and name info on non-dir?
  167. * Do they care about any event at all?
  168. */
  169. if (!inode->i_fsnotify_marks && !inode->i_sb->s_fsnotify_marks &&
  170. (!mnt || !mnt->mnt_fsnotify_marks) && !parent_watched)
  171. return 0;
  172. parent = NULL;
  173. parent_needed = fsnotify_event_needs_parent(inode, mnt, mask);
  174. if (!parent_watched && !parent_needed)
  175. goto notify;
  176. /* Does parent inode care about events on children? */
  177. parent = dget_parent(dentry);
  178. p_inode = parent->d_inode;
  179. p_mask = fsnotify_inode_watches_children(p_inode);
  180. if (unlikely(parent_watched && !p_mask))
  181. __fsnotify_update_child_dentry_flags(p_inode);
  182. /*
  183. * Include parent/name in notification either if some notification
  184. * groups require parent info or the parent is interested in this event.
  185. */
  186. parent_interested = mask & p_mask & ALL_FSNOTIFY_EVENTS;
  187. if (parent_needed || parent_interested) {
  188. /* When notifying parent, child should be passed as data */
  189. WARN_ON_ONCE(inode != fsnotify_data_inode(data, data_type));
  190. /* Notify both parent and child with child name info */
  191. take_dentry_name_snapshot(&name, dentry);
  192. file_name = &name.name;
  193. if (parent_interested)
  194. mask |= FS_EVENT_ON_CHILD;
  195. }
  196. notify:
  197. ret = fsnotify(mask, data, data_type, p_inode, file_name, inode, 0);
  198. if (file_name)
  199. release_dentry_name_snapshot(&name);
  200. dput(parent);
  201. return ret;
  202. }
  203. EXPORT_SYMBOL_GPL(__fsnotify_parent);
  204. static int fsnotify_handle_inode_event(struct fsnotify_group *group,
  205. struct fsnotify_mark *inode_mark,
  206. u32 mask, const void *data, int data_type,
  207. struct inode *dir, const struct qstr *name,
  208. u32 cookie)
  209. {
  210. const struct path *path = fsnotify_data_path(data, data_type);
  211. struct inode *inode = fsnotify_data_inode(data, data_type);
  212. const struct fsnotify_ops *ops = group->ops;
  213. if (WARN_ON_ONCE(!ops->handle_inode_event))
  214. return 0;
  215. if (WARN_ON_ONCE(!inode && !dir))
  216. return 0;
  217. if ((inode_mark->flags & FSNOTIFY_MARK_FLAG_EXCL_UNLINK) &&
  218. path && d_unlinked(path->dentry))
  219. return 0;
  220. /* Check interest of this mark in case event was sent with two marks */
  221. if (!(mask & inode_mark->mask & ALL_FSNOTIFY_EVENTS))
  222. return 0;
  223. return ops->handle_inode_event(inode_mark, mask, inode, dir, name, cookie);
  224. }
  225. static int fsnotify_handle_event(struct fsnotify_group *group, __u32 mask,
  226. const void *data, int data_type,
  227. struct inode *dir, const struct qstr *name,
  228. u32 cookie, struct fsnotify_iter_info *iter_info)
  229. {
  230. struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info);
  231. struct fsnotify_mark *parent_mark = fsnotify_iter_parent_mark(iter_info);
  232. int ret;
  233. if (WARN_ON_ONCE(fsnotify_iter_sb_mark(iter_info)) ||
  234. WARN_ON_ONCE(fsnotify_iter_vfsmount_mark(iter_info)))
  235. return 0;
  236. /*
  237. * For FS_RENAME, 'dir' is old dir and 'data' is new dentry.
  238. * The only ->handle_inode_event() backend that supports FS_RENAME is
  239. * dnotify, where it means file was renamed within same parent.
  240. */
  241. if (mask & FS_RENAME) {
  242. struct dentry *moved = fsnotify_data_dentry(data, data_type);
  243. if (dir != moved->d_parent->d_inode)
  244. return 0;
  245. }
  246. if (parent_mark) {
  247. ret = fsnotify_handle_inode_event(group, parent_mark, mask,
  248. data, data_type, dir, name, 0);
  249. if (ret)
  250. return ret;
  251. }
  252. if (!inode_mark)
  253. return 0;
  254. if (mask & FS_EVENT_ON_CHILD) {
  255. /*
  256. * Some events can be sent on both parent dir and child marks
  257. * (e.g. FS_ATTRIB). If both parent dir and child are
  258. * watching, report the event once to parent dir with name (if
  259. * interested) and once to child without name (if interested).
  260. * The child watcher is expecting an event without a file name
  261. * and without the FS_EVENT_ON_CHILD flag.
  262. */
  263. mask &= ~FS_EVENT_ON_CHILD;
  264. dir = NULL;
  265. name = NULL;
  266. }
  267. return fsnotify_handle_inode_event(group, inode_mark, mask, data, data_type,
  268. dir, name, cookie);
  269. }
  270. static int send_to_group(__u32 mask, const void *data, int data_type,
  271. struct inode *dir, const struct qstr *file_name,
  272. u32 cookie, struct fsnotify_iter_info *iter_info)
  273. {
  274. struct fsnotify_group *group = NULL;
  275. __u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS);
  276. __u32 marks_mask = 0;
  277. __u32 marks_ignore_mask = 0;
  278. bool is_dir = mask & FS_ISDIR;
  279. struct fsnotify_mark *mark;
  280. int type;
  281. if (!iter_info->report_mask)
  282. return 0;
  283. /* clear ignored on inode modification */
  284. if (mask & FS_MODIFY) {
  285. fsnotify_foreach_iter_mark_type(iter_info, mark, type) {
  286. if (!(mark->flags &
  287. FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY))
  288. mark->ignore_mask = 0;
  289. }
  290. }
  291. /* Are any of the group marks interested in this event? */
  292. fsnotify_foreach_iter_mark_type(iter_info, mark, type) {
  293. group = mark->group;
  294. marks_mask |= mark->mask;
  295. marks_ignore_mask |=
  296. fsnotify_effective_ignore_mask(mark, is_dir, type);
  297. }
  298. pr_debug("%s: group=%p mask=%x marks_mask=%x marks_ignore_mask=%x data=%p data_type=%d dir=%p cookie=%d\n",
  299. __func__, group, mask, marks_mask, marks_ignore_mask,
  300. data, data_type, dir, cookie);
  301. if (!(test_mask & marks_mask & ~marks_ignore_mask))
  302. return 0;
  303. if (group->ops->handle_event) {
  304. return group->ops->handle_event(group, mask, data, data_type, dir,
  305. file_name, cookie, iter_info);
  306. }
  307. return fsnotify_handle_event(group, mask, data, data_type, dir,
  308. file_name, cookie, iter_info);
  309. }
  310. static struct fsnotify_mark *fsnotify_first_mark(struct fsnotify_mark_connector **connp)
  311. {
  312. struct fsnotify_mark_connector *conn;
  313. struct hlist_node *node = NULL;
  314. conn = srcu_dereference(*connp, &fsnotify_mark_srcu);
  315. if (conn)
  316. node = srcu_dereference(conn->list.first, &fsnotify_mark_srcu);
  317. return hlist_entry_safe(node, struct fsnotify_mark, obj_list);
  318. }
  319. static struct fsnotify_mark *fsnotify_next_mark(struct fsnotify_mark *mark)
  320. {
  321. struct hlist_node *node = NULL;
  322. if (mark)
  323. node = srcu_dereference(mark->obj_list.next,
  324. &fsnotify_mark_srcu);
  325. return hlist_entry_safe(node, struct fsnotify_mark, obj_list);
  326. }
  327. /*
  328. * iter_info is a multi head priority queue of marks.
  329. * Pick a subset of marks from queue heads, all with the same group
  330. * and set the report_mask to a subset of the selected marks.
  331. * Returns false if there are no more groups to iterate.
  332. */
  333. static bool fsnotify_iter_select_report_types(
  334. struct fsnotify_iter_info *iter_info)
  335. {
  336. struct fsnotify_group *max_prio_group = NULL;
  337. struct fsnotify_mark *mark;
  338. int type;
  339. /* Choose max prio group among groups of all queue heads */
  340. fsnotify_foreach_iter_type(type) {
  341. mark = iter_info->marks[type];
  342. if (mark &&
  343. fsnotify_compare_groups(max_prio_group, mark->group) > 0)
  344. max_prio_group = mark->group;
  345. }
  346. if (!max_prio_group)
  347. return false;
  348. /* Set the report mask for marks from same group as max prio group */
  349. iter_info->current_group = max_prio_group;
  350. iter_info->report_mask = 0;
  351. fsnotify_foreach_iter_type(type) {
  352. mark = iter_info->marks[type];
  353. if (mark && mark->group == iter_info->current_group) {
  354. /*
  355. * FSNOTIFY_ITER_TYPE_PARENT indicates that this inode
  356. * is watching children and interested in this event,
  357. * which is an event possible on child.
  358. * But is *this mark* watching children?
  359. */
  360. if (type == FSNOTIFY_ITER_TYPE_PARENT &&
  361. !(mark->mask & FS_EVENT_ON_CHILD) &&
  362. !(fsnotify_ignore_mask(mark) & FS_EVENT_ON_CHILD))
  363. continue;
  364. fsnotify_iter_set_report_type(iter_info, type);
  365. }
  366. }
  367. return true;
  368. }
  369. /*
  370. * Pop from iter_info multi head queue, the marks that belong to the group of
  371. * current iteration step.
  372. */
  373. static void fsnotify_iter_next(struct fsnotify_iter_info *iter_info)
  374. {
  375. struct fsnotify_mark *mark;
  376. int type;
  377. /*
  378. * We cannot use fsnotify_foreach_iter_mark_type() here because we
  379. * may need to advance a mark of type X that belongs to current_group
  380. * but was not selected for reporting.
  381. */
  382. fsnotify_foreach_iter_type(type) {
  383. mark = iter_info->marks[type];
  384. if (mark && mark->group == iter_info->current_group)
  385. iter_info->marks[type] =
  386. fsnotify_next_mark(iter_info->marks[type]);
  387. }
  388. }
  389. /*
  390. * fsnotify - This is the main call to fsnotify.
  391. *
  392. * The VFS calls into hook specific functions in linux/fsnotify.h.
  393. * Those functions then in turn call here. Here will call out to all of the
  394. * registered fsnotify_group. Those groups can then use the notification event
  395. * in whatever means they feel necessary.
  396. *
  397. * @mask: event type and flags
  398. * @data: object that event happened on
  399. * @data_type: type of object for fanotify_data_XXX() accessors
  400. * @dir: optional directory associated with event -
  401. * if @file_name is not NULL, this is the directory that
  402. * @file_name is relative to
  403. * @file_name: optional file name associated with event
  404. * @inode: optional inode associated with event -
  405. * If @dir and @inode are both non-NULL, event may be
  406. * reported to both.
  407. * @cookie: inotify rename cookie
  408. */
  409. int fsnotify(__u32 mask, const void *data, int data_type, struct inode *dir,
  410. const struct qstr *file_name, struct inode *inode, u32 cookie)
  411. {
  412. const struct path *path = fsnotify_data_path(data, data_type);
  413. struct super_block *sb = fsnotify_data_sb(data, data_type);
  414. struct fsnotify_iter_info iter_info = {};
  415. struct mount *mnt = NULL;
  416. struct inode *inode2 = NULL;
  417. struct dentry *moved;
  418. int inode2_type;
  419. int ret = 0;
  420. __u32 test_mask, marks_mask;
  421. if (path)
  422. mnt = real_mount(path->mnt);
  423. if (!inode) {
  424. /* Dirent event - report on TYPE_INODE to dir */
  425. inode = dir;
  426. /* For FS_RENAME, inode is old_dir and inode2 is new_dir */
  427. if (mask & FS_RENAME) {
  428. moved = fsnotify_data_dentry(data, data_type);
  429. inode2 = moved->d_parent->d_inode;
  430. inode2_type = FSNOTIFY_ITER_TYPE_INODE2;
  431. }
  432. } else if (mask & FS_EVENT_ON_CHILD) {
  433. /*
  434. * Event on child - report on TYPE_PARENT to dir if it is
  435. * watching children and on TYPE_INODE to child.
  436. */
  437. inode2 = dir;
  438. inode2_type = FSNOTIFY_ITER_TYPE_PARENT;
  439. }
  440. /*
  441. * Optimization: srcu_read_lock() has a memory barrier which can
  442. * be expensive. It protects walking the *_fsnotify_marks lists.
  443. * However, if we do not walk the lists, we do not have to do
  444. * SRCU because we have no references to any objects and do not
  445. * need SRCU to keep them "alive".
  446. */
  447. if (!sb->s_fsnotify_marks &&
  448. (!mnt || !mnt->mnt_fsnotify_marks) &&
  449. (!inode || !inode->i_fsnotify_marks) &&
  450. (!inode2 || !inode2->i_fsnotify_marks))
  451. return 0;
  452. marks_mask = sb->s_fsnotify_mask;
  453. if (mnt)
  454. marks_mask |= mnt->mnt_fsnotify_mask;
  455. if (inode)
  456. marks_mask |= inode->i_fsnotify_mask;
  457. if (inode2)
  458. marks_mask |= inode2->i_fsnotify_mask;
  459. /*
  460. * If this is a modify event we may need to clear some ignore masks.
  461. * In that case, the object with ignore masks will have the FS_MODIFY
  462. * event in its mask.
  463. * Otherwise, return if none of the marks care about this type of event.
  464. */
  465. test_mask = (mask & ALL_FSNOTIFY_EVENTS);
  466. if (!(test_mask & marks_mask))
  467. return 0;
  468. iter_info.srcu_idx = srcu_read_lock(&fsnotify_mark_srcu);
  469. iter_info.marks[FSNOTIFY_ITER_TYPE_SB] =
  470. fsnotify_first_mark(&sb->s_fsnotify_marks);
  471. if (mnt) {
  472. iter_info.marks[FSNOTIFY_ITER_TYPE_VFSMOUNT] =
  473. fsnotify_first_mark(&mnt->mnt_fsnotify_marks);
  474. }
  475. if (inode) {
  476. iter_info.marks[FSNOTIFY_ITER_TYPE_INODE] =
  477. fsnotify_first_mark(&inode->i_fsnotify_marks);
  478. }
  479. if (inode2) {
  480. iter_info.marks[inode2_type] =
  481. fsnotify_first_mark(&inode2->i_fsnotify_marks);
  482. }
  483. /*
  484. * We need to merge inode/vfsmount/sb mark lists so that e.g. inode mark
  485. * ignore masks are properly reflected for mount/sb mark notifications.
  486. * That's why this traversal is so complicated...
  487. */
  488. while (fsnotify_iter_select_report_types(&iter_info)) {
  489. ret = send_to_group(mask, data, data_type, dir, file_name,
  490. cookie, &iter_info);
  491. if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS))
  492. goto out;
  493. fsnotify_iter_next(&iter_info);
  494. }
  495. ret = 0;
  496. out:
  497. srcu_read_unlock(&fsnotify_mark_srcu, iter_info.srcu_idx);
  498. return ret;
  499. }
  500. EXPORT_SYMBOL_GPL(fsnotify);
  501. static __init int fsnotify_init(void)
  502. {
  503. int ret;
  504. BUILD_BUG_ON(HWEIGHT32(ALL_FSNOTIFY_BITS) != 23);
  505. ret = init_srcu_struct(&fsnotify_mark_srcu);
  506. if (ret)
  507. panic("initializing fsnotify_mark_srcu");
  508. fsnotify_mark_connector_cachep = KMEM_CACHE(fsnotify_mark_connector,
  509. SLAB_PANIC);
  510. return 0;
  511. }
  512. core_initcall(fsnotify_init);