[patch 19/35] fs: icache remove redundant i_sb_list umount locking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In preparation for rcu walking the inode sb lists, remove some
locking from the inode umount path according to comments and
the fact that we already rely on the list not changing at these
points.

Signed-off-by: Nick Piggin <npiggin@xxxxxxxxx>

---
 fs/inode.c             |   15 +++++----------
 fs/notify/inode_mark.c |   15 +++------------
 2 files changed, 8 insertions(+), 22 deletions(-)

Index: linux-2.6/fs/inode.c
===================================================================
--- linux-2.6.orig/fs/inode.c	2010-10-19 14:18:59.000000000 +1100
+++ linux-2.6/fs/inode.c	2010-10-19 14:19:25.000000000 +1100
@@ -407,14 +407,6 @@
 		struct list_head *tmp = next;
 		struct inode *inode;
 
-		/*
-		 * We can reschedule here without worrying about the list's
-		 * consistency because the per-sb list of inodes must not
-		 * change during umount anymore, and because iprune_sem keeps
-		 * shrink_icache_memory() away.
-		 */
-		cond_resched_lock(&sb_inode_list_lock);
-
 		next = next->next;
 		if (tmp == head)
 			break;
@@ -458,10 +450,13 @@
 	LIST_HEAD(throw_away);
 
 	down_write(&iprune_sem);
-	spin_lock(&sb_inode_list_lock);
+	/*
+	 * We can walk the per-sb list of inodes here without worrying about
+	 * its consistency, because the list must not change during umount
+	 * anymore, and because iprune_sem keeps shrink_icache_memory() away.
+	 */
 	fsnotify_unmount_inodes(&sb->s_inodes);
 	busy = invalidate_list(&sb->s_inodes, &throw_away);
-	spin_unlock(&sb_inode_list_lock);
 
 	dispose_list(&throw_away);
 	up_write(&iprune_sem);
Index: linux-2.6/fs/notify/inode_mark.c
===================================================================
--- linux-2.6.orig/fs/notify/inode_mark.c	2010-10-19 14:18:59.000000000 +1100
+++ linux-2.6/fs/notify/inode_mark.c	2010-10-19 14:19:24.000000000 +1100
@@ -232,8 +232,9 @@
  * fsnotify_unmount_inodes - an sb is unmounting.  handle any watched inodes.
  * @list: list of inodes being unmounted (sb->s_inodes)
  *
- * Called with iprune_mutex held, keeping shrink_icache_memory() at bay.
- * sb_inode_list_lock to protect the super block's list of inodes.
+ * Called with iprune_mutex held, keeping shrink_icache_memory() at bay,
+ * and with the sb going away, no new inodes will appear or be referenced
+ * from other paths.
  */
 void fsnotify_unmount_inodes(struct list_head *list)
 {
@@ -285,14 +286,6 @@
 			spin_unlock(&next_i->i_lock);
 		}
 
-		/*
-		 * We can safely drop sb_inode_list_lock here because we hold
-		 * references on both inode and next_i.  Also no new inodes
-		 * will be added since the umount has begun.  Finally,
-		 * iprune_mutex keeps shrink_icache_memory() away.
-		 */
-		spin_unlock(&sb_inode_list_lock);
-
 		if (need_iput_tmp)
 			iput(need_iput_tmp);
 
@@ -302,7 +295,5 @@
 		fsnotify_inode_delete(inode);
 
 		iput(inode);
-
-		spin_lock(&sb_inode_list_lock);
 	}
 }


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux