summaryrefslogtreecommitdiffstats
path: root/fs/notify/mark.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-07-28 10:18:38 -0400
committerEric Paris <eparis@redhat.com>2010-07-28 10:18:52 -0400
commit700307a29ad61090dcf1d45f8f4a135f5e9211ae (patch)
tree08b7969486c0039495684a6c13bbac3124a40348 /fs/notify/mark.c
parenta4c6e9961fcb9da54648d98978d33c6fdcb7bb45 (diff)
downloadlinux-700307a29ad61090dcf1d45f8f4a135f5e9211ae.tar.bz2
fsnotify: use an explicit flag to indicate fsnotify_destroy_mark has been called
Currently fsnotify check is mark->group is NULL to decide if fsnotify_destroy_mark() has already been called or not. With the upcoming rcu work it is a heck of a lot easier to use an explicit flag than worry about group being set to NULL. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/mark.c')
-rw-r--r--fs/notify/mark.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index 8f3b0e7a543d..69c5a166930c 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -121,12 +121,14 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark)
group = mark->group;
- /* if !group something else already marked this to die */
- if (!group) {
+ /* something else already called this function on this mark */
+ if (!(mark->flags & FSNOTIFY_MARK_FLAG_ALIVE)) {
spin_unlock(&mark->lock);
return;
}
+ mark->flags &= ~FSNOTIFY_MARK_FLAG_ALIVE;
+
/* 1 from caller and 1 for being on i_list/g_list */
BUG_ON(atomic_read(&mark->refcnt) < 2);
@@ -141,7 +143,6 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark)
BUG();
list_del_init(&mark->g_list);
- mark->group = NULL;
fsnotify_put_mark(mark); /* for i_list and g_list */
@@ -229,6 +230,8 @@ int fsnotify_add_mark(struct fsnotify_mark *mark,
spin_lock(&mark->lock);
spin_lock(&group->mark_lock);
+ mark->flags |= FSNOTIFY_MARK_FLAG_ALIVE;
+
mark->group = group;
list_add(&mark->g_list, &group->marks_list);
atomic_inc(&group->num_marks);
@@ -258,7 +261,7 @@ int fsnotify_add_mark(struct fsnotify_mark *mark,
return ret;
err:
- mark->group = NULL;
+ mark->flags &= ~FSNOTIFY_MARK_FLAG_ALIVE;
list_del_init(&mark->g_list);
atomic_dec(&group->num_marks);
fsnotify_put_mark(mark);