diff options
author | Eric Paris <eparis@redhat.com> | 2009-12-17 21:24:27 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:58:57 -0400 |
commit | 0d48b7f01f442bc88a69aa98f3b6b015f2817608 (patch) | |
tree | 6b484d9b8ac355609e9b2783169ed584cc365f9a /fs/notify/mark.c | |
parent | 2504c5d63b811b71bbaa8d5d5af163e698f4df1f (diff) |
fsnotify: vfsmount marks generic functions
Much like inode-mark.c has all of the code dealing with marks on inodes
this patch adds a vfsmount-mark.c which has similar code but is intended
for marks on vfsmounts.
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/mark.c')
-rw-r--r-- | fs/notify/mark.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/notify/mark.c b/fs/notify/mark.c index 57bb1d74a2b..d296ec9ffb2 100644 --- a/fs/notify/mark.c +++ b/fs/notify/mark.c @@ -115,15 +115,11 @@ void fsnotify_put_mark(struct fsnotify_mark *mark) void fsnotify_destroy_mark(struct fsnotify_mark *mark) { struct fsnotify_group *group; - struct inode *inode; + struct inode *inode = NULL; spin_lock(&mark->lock); group = mark->group; - inode = mark->i.inode; - - BUG_ON(group && !inode); - BUG_ON(!group && inode); /* if !group something else already marked this to die */ if (!group) { @@ -136,8 +132,11 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark) spin_lock(&group->mark_lock); - if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) + if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) { fsnotify_destroy_inode_mark(mark); + inode = mark->i.inode; + } else if (mark->flags & FSNOTIFY_MARK_FLAG_VFSMOUNT) + fsnotify_destroy_vfsmount_mark(mark); else BUG(); @@ -169,8 +168,8 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark) * is just a lazy update (and could be a perf win...) */ - - iput(inode); + if (inode) + iput(inode); /* * it's possible that this group tried to destroy itself, but this @@ -192,7 +191,6 @@ int fsnotify_add_mark(struct fsnotify_mark *mark, { int ret = 0; - BUG_ON(mnt); BUG_ON(inode && mnt); BUG_ON(!inode && !mnt); @@ -223,6 +221,10 @@ int fsnotify_add_mark(struct fsnotify_mark *mark, ret = fsnotify_add_inode_mark(mark, group, inode, allow_dups); if (ret) goto err; + } else if (mnt) { + ret = fsnotify_add_vfsmount_mark(mark, group, mnt, allow_dups); + if (ret) + goto err; } else { BUG(); } |