diff -puN fs/notify/fsnotify.h~fsnotify_recalc_mask-redo fs/notify/fsnotify.h
--- a/fs/notify/fsnotify.h~fsnotify_recalc_mask-redo	2015-06-24 17:14:36.757207417 -0700
+++ b/fs/notify/fsnotify.h	2015-06-24 17:14:36.766207822 -0700
@@ -3,6 +3,7 @@
 
 #include <linux/list.h>
 #include <linux/fsnotify.h>
+#include <linux/fsnotify_head.h>
 #include <linux/srcu.h>
 #include <linux/types.h>
 
@@ -12,8 +13,8 @@ extern void fsnotify_flush_notify(struct
 /* protects reads of inode and vfsmount marks list */
 extern struct srcu_struct fsnotify_mark_srcu;
 
-/* Calculate mask of events for a list of marks */
-extern u32 fsnotify_recalc_mask(struct hlist_head *head);
+/* Recalculate the fsnotify_head's mask from its marks */
+extern void fsnotify_recalc_mask(struct fsnotify_head *fsn);
 
 /* compare two groups for sorting of marks lists */
 extern int fsnotify_compare_groups(struct fsnotify_group *a,
diff -puN fs/notify/inode_mark.c~fsnotify_recalc_mask-redo fs/notify/inode_mark.c
--- a/fs/notify/inode_mark.c~fsnotify_recalc_mask-redo	2015-06-24 17:14:36.759207507 -0700
+++ b/fs/notify/inode_mark.c	2015-06-24 17:14:36.766207822 -0700
@@ -37,7 +37,7 @@
 void fsnotify_recalc_inode_mask(struct inode *inode)
 {
 	spin_lock(&inode->i_lock);
-	inode->i_fsnotify.mask = fsnotify_recalc_mask(&inode->i_fsnotify.marks);
+	fsnotify_recalc_mask(&inode->i_fsnotify);
 	spin_unlock(&inode->i_lock);
 
 	__fsnotify_update_child_dentry_flags(inode);
@@ -60,7 +60,7 @@ void fsnotify_destroy_inode_mark(struct
 	 * hold the inode->i_lock, so this is the perfect time to update the
 	 * inode->i_fsnotify.mask
 	 */
-	inode->i_fsnotify.mask = fsnotify_recalc_mask(&inode->i_fsnotify.marks);
+	fsnotify_recalc_mask(&inode->i_fsnotify);
 	spin_unlock(&inode->i_lock);
 }
 
@@ -155,7 +155,7 @@ int fsnotify_add_inode_mark(struct fsnot
 	mark->inode = inode;
 	ret = fsnotify_add_mark_list(&inode->i_fsnotify.marks, mark,
 				     allow_dups);
-	inode->i_fsnotify.mask = fsnotify_recalc_mask(&inode->i_fsnotify.marks);
+	fsnotify_recalc_mask(&inode->i_fsnotify);
 	spin_unlock(&inode->i_lock);
 
 	return ret;
diff -puN fs/notify/mark.c~fsnotify_recalc_mask-redo fs/notify/mark.c
--- a/fs/notify/mark.c~fsnotify_recalc_mask-redo	2015-06-24 17:14:36.760207552 -0700
+++ b/fs/notify/mark.c	2015-06-24 17:14:36.765207777 -0700
@@ -89,6 +89,7 @@
 #include <linux/atomic.h>
 
 #include <linux/fsnotify_backend.h>
+#include <linux/fsnotify_head.h>
 #include "fsnotify.h"
 
 struct srcu_struct fsnotify_mark_srcu;
@@ -111,14 +112,15 @@ void fsnotify_put_mark(struct fsnotify_m
 }
 
 /* Calculate mask of events for a list of marks */
-u32 fsnotify_recalc_mask(struct hlist_head *head)
+void fsnotify_recalc_mask(struct fsnotify_head *fsn)
 {
 	u32 new_mask = 0;
 	struct fsnotify_mark *mark;
 
-	hlist_for_each_entry(mark, head, obj_list)
+	hlist_for_each_entry(mark, &fsn->marks, obj_list)
 		new_mask |= mark->mask;
-	return new_mask;
+
+	fsn->mask = new_mask;
 }
 
 /*
diff -puN fs/notify/vfsmount_mark.c~fsnotify_recalc_mask-redo fs/notify/vfsmount_mark.c
--- a/fs/notify/vfsmount_mark.c~fsnotify_recalc_mask-redo	2015-06-24 17:14:36.762207642 -0700
+++ b/fs/notify/vfsmount_mark.c	2015-06-24 17:14:36.766207822 -0700
@@ -62,7 +62,7 @@ void fsnotify_recalc_vfsmount_mask(struc
 	struct mount *m = real_mount(mnt);
 
 	spin_lock(&mnt->mnt_root->d_lock);
-	m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks);
+	fsnotify_recalc_mask(&m->mnt_fsnotify);
 	spin_unlock(&mnt->mnt_root->d_lock);
 }
 
@@ -79,7 +79,7 @@ void fsnotify_destroy_vfsmount_mark(stru
 	hlist_del_init_rcu(&mark->obj_list);
 	mark->mnt = NULL;
 
-	m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks);
+	fsnotify_recalc_mask(&m->mnt_fsnotify);
 	spin_unlock(&mnt->mnt_root->d_lock);
 }
 
@@ -120,7 +120,7 @@ int fsnotify_add_vfsmount_mark(struct fs
 	spin_lock(&mnt->mnt_root->d_lock);
 	mark->mnt = mnt;
 	ret = fsnotify_add_mark_list(&m->mnt_fsnotify.marks, mark, allow_dups);
-	m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks);
+	fsnotify_recalc_mask(&m->mnt_fsnotify);
 	spin_unlock(&mnt->mnt_root->d_lock);
 
 	return ret;
