Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Fix the extattr start fix. Looking up the filesyste...



details:   https://anonhg.NetBSD.org/src/rev/d4dd20a9640b
branches:  trunk
changeset: 779075:d4dd20a9640b
user:      manu <manu%NetBSD.org@localhost>
date:      Mon Apr 30 10:05:12 2012 +0000

description:
Fix the extattr start fix. Looking up the filesystemroot vnode again
does not seems to be reliable. Instead save it before mount_domount()
sets it to NULL.

diffstat:

 sys/kern/vfs_syscalls.c |  25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diffs (58 lines):

diff -r a06137b1012d -r d4dd20a9640b sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Mon Apr 30 03:51:10 2012 +0000
+++ b/sys/kern/vfs_syscalls.c   Mon Apr 30 10:05:12 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.453 2012/04/30 03:51:10 manu Exp $  */
+/*     $NetBSD: vfs_syscalls.c,v 1.454 2012/04/30 10:05:12 manu Exp $  */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.453 2012/04/30 03:51:10 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.454 2012/04/30 10:05:12 manu Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -458,6 +458,12 @@
        } else if (flags & MNT_UPDATE) {
                error = mount_update(l, vp, path, flags, data_buf, &data_len);
        } else {
+               struct vnode *svp;
+
+               /* Save vp as mount_domount sets it to NULL */
+               vref(vp);
+               svp = vp;       
+
                /* Locking is handled internally in mount_domount(). */
                KASSERT(vfsopsrele == true);
                error = mount_domount(l, &vp, vfsops, path, flags, data_buf,
@@ -465,20 +471,17 @@
                vfsopsrele = false;
 
                if ((error == 0) && (flags & MNT_EXTATTR)) {
-                       if ((error = namei_simple_user(path, 
-                           NSM_FOLLOW_TRYEMULROOT, &vp)) != 0)
-                               goto done;
-
-                       if (vp->v_mountedhere == NULL)
-                               goto done;
-
-                       if (VFS_EXTATTRCTL(vp->v_mountedhere,
+                       KASSERT(svp->v_mountedhere != NULL);
+
+                       if (VFS_EXTATTRCTL(svp->v_mountedhere,
                                           EXTATTR_CMD_START, 
                                           NULL, 0, NULL) != 0)
                                printf("%s: failed to start extattr",
-                                      vp->v_mountedhere->mnt_stat.f_mntonname);
+                                    svp->v_mountedhere->mnt_stat.f_mntonname);
                                /* XXX remove flag */
                }
+
+               vrele(svp);
        }
 
     done:



Home | Main Index | Thread Index | Old Index