summaryrefslogtreecommitdiff
path: root/fs/notify/mark.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/notify/mark.c')
-rw-r--r--fs/notify/mark.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index 57bb1d74a2b6..d296ec9ffb2a 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();
}