aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2009-12-17 21:24:27 -0500
committerEric Paris <eparis@redhat.com>2010-07-28 09:58:57 -0400
commitca9c726eea013394d1e846331b117effb21ead83 (patch)
treede2319fb43b4fa16d07ecbcd75022cdaf9a757e1
parent0d48b7f01f442bc88a69aa98f3b6b015f2817608 (diff)
fsnotify: Infrastructure for per-mount watches
Per-mount watches allow groups to listen to fsnotify events on an entire mount. This patch simply adds and initializes the fields needed in the vfsmount struct to make this happen. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r--fs/namespace.c1
-rw-r--r--fs/notify/fsnotify.c5
-rw-r--r--fs/notify/fsnotify.h2
-rw-r--r--include/linux/fsnotify.h8
-rw-r--r--include/linux/fsnotify_backend.h4
5 files changed, 20 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index a2d681a6b5e9..1969d6b2571e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -614,6 +614,7 @@ static inline void __mntput(struct vfsmount *mnt)
614 * provides barriers, so count_mnt_writers() below is safe. AV 614 * provides barriers, so count_mnt_writers() below is safe. AV
615 */ 615 */
616 WARN_ON(count_mnt_writers(mnt)); 616 WARN_ON(count_mnt_writers(mnt));
617 fsnotify_vfsmount_delete(mnt);
617 dput(mnt->mnt_root); 618 dput(mnt->mnt_root);
618 free_vfsmnt(mnt); 619 free_vfsmnt(mnt);
619 deactivate_super(sb); 620 deactivate_super(sb);
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index e0bf86953e1b..7f14ddc3efc2 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -36,6 +36,11 @@ void __fsnotify_inode_delete(struct inode *inode)
36} 36}
37EXPORT_SYMBOL_GPL(__fsnotify_inode_delete); 37EXPORT_SYMBOL_GPL(__fsnotify_inode_delete);
38 38
39void __fsnotify_vfsmount_delete(struct vfsmount *mnt)
40{
41 fsnotify_clear_marks_by_mount(mnt);
42}
43
39/* 44/*
40 * Given an inode, first check if we care what happens to our children. Inotify 45 * Given an inode, first check if we care what happens to our children. Inotify
41 * and dnotify both tell their parents about events. If we care about any event 46 * and dnotify both tell their parents about events. If we care about any event
diff --git a/fs/notify/fsnotify.h b/fs/notify/fsnotify.h
index 38f3fb5cef28..204353c0f663 100644
--- a/fs/notify/fsnotify.h
+++ b/fs/notify/fsnotify.h
@@ -42,6 +42,8 @@ extern void fsnotify_destroy_vfsmount_mark(struct fsnotify_mark *mark);
42extern void fsnotify_destroy_inode_mark(struct fsnotify_mark *mark); 42extern void fsnotify_destroy_inode_mark(struct fsnotify_mark *mark);
43/* run the list of all marks associated with inode and flag them to be freed */ 43/* run the list of all marks associated with inode and flag them to be freed */
44extern void fsnotify_clear_marks_by_inode(struct inode *inode); 44extern void fsnotify_clear_marks_by_inode(struct inode *inode);
45/* run the list of all marks associated with vfsmount and flag them to be freed */
46extern void fsnotify_clear_marks_by_mount(struct vfsmount *mnt);
45/* 47/*
46 * update the dentry->d_flags of all of inode's children to indicate if inode cares 48 * update the dentry->d_flags of all of inode's children to indicate if inode cares
47 * about events that happen to its children. 49 * about events that happen to its children.
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 5184a2b786c1..06c0e50c7968 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -96,6 +96,14 @@ static inline void fsnotify_inode_delete(struct inode *inode)
96} 96}
97 97
98/* 98/*
99 * fsnotify_vfsmount_delete - a vfsmount is being destroyed, clean up is needed
100 */
101static inline void fsnotify_vfsmount_delete(struct vfsmount *mnt)
102{
103 __fsnotify_vfsmount_delete(mnt);
104}
105
106/*
99 * fsnotify_nameremove - a filename was removed from a directory 107 * fsnotify_nameremove - a filename was removed from a directory
100 */ 108 */
101static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) 109static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index f21ff1bd4b5a..1af42cbfc429 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -282,6 +282,7 @@ extern void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
282 const char *name, u32 cookie); 282 const char *name, u32 cookie);
283extern void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask); 283extern void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask);
284extern void __fsnotify_inode_delete(struct inode *inode); 284extern void __fsnotify_inode_delete(struct inode *inode);
285extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
285extern u32 fsnotify_get_cookie(void); 286extern u32 fsnotify_get_cookie(void);
286 287
287static inline int fsnotify_inode_watches_children(struct inode *inode) 288static inline int fsnotify_inode_watches_children(struct inode *inode)
@@ -402,6 +403,9 @@ static inline void __fsnotify_parent(struct path *path, struct dentry *dentry, _
402static inline void __fsnotify_inode_delete(struct inode *inode) 403static inline void __fsnotify_inode_delete(struct inode *inode)
403{} 404{}
404 405
406static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt)
407{}
408
405static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) 409static inline void __fsnotify_update_dcache_flags(struct dentry *dentry)
406{} 410{}
407 411