Skip to contentSkip to conversation

vfsmount_lock / mnt_parent

PATCH In review Mike Waychison 1 participant 1 message Jan 26, 2004 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 vfsmount_lock / mnt_parent

This patch makes __d_name grab vfsmount_lock when walking up the mount-tree.

Signature · 11 lines
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice
mailto: [email protected]
http://www.sun.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE:  The opinions expressed in this email are held by me,
and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1520 -> 1.1521
# fs/dcache.c 1.64 -> 1.65
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/01/26 [email protected] 1.1521
# dcache.c:
# - protect vfsmount->mnt_parent by nesting vfsmount_lock in __d_path
# --------------------------------------------
#

fs/dcache.c +5 -1
diff -Nru a/fs/dcache.c b/fs/dcache.c
@@ -1296,10 +1296,14 @@
 			break;
 		if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
 			/* Global root? */
-			if (vfsmnt->mnt_parent == vfsmnt)
+			spin_lock(&vfsmount_lock);
+			if (vfsmnt->mnt_parent == vfsmnt) {
+				spin_unlock(&vfsmount_lock);
 				goto global_root;
+			}
 			dentry = vfsmnt->mnt_mountpoint;
 			vfsmnt = vfsmnt->mnt_parent;
+			spin_unlock(&vfsmount_lock);
 			continue;
 		}
 		parent = dentry->d_parent;