summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-11-10 18:56:59 -0500
committerEric Paris <eparis@redhat.com>2010-11-29 14:51:25 -0500
commit50bcd0e8a64089f4f0406bc3c661c9c90a3ad17a (patch)
treeef946cd11f69986fcd6e85fbf899f68bcd10f635 /fs
parent66394404f412fad831430a4f7d82e5a48417d290 (diff)
Revert "fanotify: Do check against max_marks and increase number of group marks atomically"
This reverts commit 5876b30fc2c91d67386f91da62b14f159d7bb41f. This was reverted due to: Hi Eric, After merging the fsnotify tree, today's linux-next build (powerpc ppc64_defconfig) failed like this: fs/notify/mark.c: In function 'fsnotify_add_mark': fs/notify/mark.c:230: error: 'struct fsnotify_group' has no member named 'fanotify_data' Caused by commit 0ed64ab6b338e4269c9f25de83781619ecd624f1 ("fsnotify: code and error path cleanup in fsnotify_add_mark"). This build has CONFIG_FANOTIFY not set. I have used the fsnotify tree from next-20101109 for today. Conflicts: fs/notify/mark.c
Diffstat (limited to 'fs')
-rw-r--r--fs/notify/fanotify/fanotify_user.c6
-rw-r--r--fs/notify/mark.c5
2 files changed, 7 insertions, 4 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index e1587fc4626d..772a5dccc5cd 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -609,6 +609,9 @@ static int fanotify_add_vfsmount_mark(struct fsnotify_group *group,
fsn_mark = fsnotify_find_vfsmount_mark(group, mnt);
if (!fsn_mark) {
+ if (atomic_read(&group->num_marks) > group->fanotify_data.max_marks)
+ return -ENOSPC;
+
fsn_mark = kmem_cache_alloc(fanotify_mark_cache, GFP_KERNEL);
if (!fsn_mark)
return -ENOMEM;
@@ -649,6 +652,9 @@ static int fanotify_add_inode_mark(struct fsnotify_group *group,
fsn_mark = fsnotify_find_inode_mark(group, inode);
if (!fsn_mark) {
+ if (atomic_read(&group->num_marks) > group->fanotify_data.max_marks)
+ return -ENOSPC;
+
fsn_mark = kmem_cache_alloc(fanotify_mark_cache, GFP_KERNEL);
if (!fsn_mark)
return -ENOMEM;
diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index a381f53abf0d..28b64eb03e33 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -226,10 +226,6 @@ int fsnotify_add_mark(struct fsnotify_mark *mark,
fsnotify_get_mark(mark); /* for i_list and g_list */
atomic_inc(&group->num_marks);
- ret = -ENOSPC;
- if (atomic_read(&group->num_marks) > group->fanotify_data.max_marks)
- goto err;
-
ret = 0;
if (inode)
ret = fsnotify_add_inode_mark(mark, group, inode, allow_dups);
@@ -256,6 +252,7 @@ err:
list_del_init(&mark->g_list);
mark->group = NULL;
atomic_dec(&group->num_marks);
+
spin_unlock(&group->mark_lock);
spin_unlock(&mark->lock);