diff options
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 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) | |||
115 | void fsnotify_destroy_mark(struct fsnotify_mark *mark) | 115 | void fsnotify_destroy_mark(struct fsnotify_mark *mark) |
116 | { | 116 | { |
117 | struct fsnotify_group *group; | 117 | struct fsnotify_group *group; |
118 | struct inode *inode; | 118 | struct inode *inode = NULL; |
119 | 119 | ||
120 | spin_lock(&mark->lock); | 120 | spin_lock(&mark->lock); |
121 | 121 | ||
122 | group = mark->group; | 122 | group = mark->group; |
123 | inode = mark->i.inode; | ||
124 | |||
125 | BUG_ON(group && !inode); | ||
126 | BUG_ON(!group && inode); | ||
127 | 123 | ||
128 | /* if !group something else already marked this to die */ | 124 | /* if !group something else already marked this to die */ |
129 | if (!group) { | 125 | if (!group) { |
@@ -136,8 +132,11 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark) | |||
136 | 132 | ||
137 | spin_lock(&group->mark_lock); | 133 | spin_lock(&group->mark_lock); |
138 | 134 | ||
139 | if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) | 135 | if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) { |
140 | fsnotify_destroy_inode_mark(mark); | 136 | fsnotify_destroy_inode_mark(mark); |
137 | inode = mark->i.inode; | ||
138 | } else if (mark->flags & FSNOTIFY_MARK_FLAG_VFSMOUNT) | ||
139 | fsnotify_destroy_vfsmount_mark(mark); | ||
141 | else | 140 | else |
142 | BUG(); | 141 | BUG(); |
143 | 142 | ||
@@ -169,8 +168,8 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark) | |||
169 | * is just a lazy update (and could be a perf win...) | 168 | * is just a lazy update (and could be a perf win...) |
170 | */ | 169 | */ |
171 | 170 | ||
172 | 171 | if (inode) | |
173 | iput(inode); | 172 | iput(inode); |
174 | 173 | ||
175 | /* | 174 | /* |
176 | * it's possible that this group tried to destroy itself, but this | 175 | * it's possible that this group tried to destroy itself, but this |
@@ -192,7 +191,6 @@ int fsnotify_add_mark(struct fsnotify_mark *mark, | |||
192 | { | 191 | { |
193 | int ret = 0; | 192 | int ret = 0; |
194 | 193 | ||
195 | BUG_ON(mnt); | ||
196 | BUG_ON(inode && mnt); | 194 | BUG_ON(inode && mnt); |
197 | BUG_ON(!inode && !mnt); | 195 | BUG_ON(!inode && !mnt); |
198 | 196 | ||
@@ -223,6 +221,10 @@ int fsnotify_add_mark(struct fsnotify_mark *mark, | |||
223 | ret = fsnotify_add_inode_mark(mark, group, inode, allow_dups); | 221 | ret = fsnotify_add_inode_mark(mark, group, inode, allow_dups); |
224 | if (ret) | 222 | if (ret) |
225 | goto err; | 223 | goto err; |
224 | } else if (mnt) { | ||
225 | ret = fsnotify_add_vfsmount_mark(mark, group, mnt, allow_dups); | ||
226 | if (ret) | ||
227 | goto err; | ||
226 | } else { | 228 | } else { |
227 | BUG(); | 229 | BUG(); |
228 | } | 230 | } |