]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] __d_path needs vfsmount_lock
authorAndrew Morton <akpm@osdl.org>
Wed, 4 Feb 2004 02:47:18 +0000 (18:47 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 4 Feb 2004 02:47:18 +0000 (18:47 -0800)
From: Mike Waychison <Michael.Waychison@Sun.COM>

- protect vfsmount->mnt_parent by taking vfsmount_lock in __d_path

fs/dcache.c

index b6d266fac29f5eae327ab11c12a00919c7cd080f..83166383bf94a029b8b061a7ab5d37a7ce00542d 100644 (file)
@@ -1296,10 +1296,14 @@ static char * __d_path( struct dentry *dentry, struct vfsmount *vfsmnt,
                        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;