Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Do not use vp after mount_domount() call as it sets...



details:   https://anonhg.NetBSD.org/src/rev/7fd791069449
branches:  trunk
changeset: 779044:7fd791069449
user:      manu <manu%NetBSD.org@localhost>
date:      Sat Apr 28 17:30:19 2012 +0000

description:
Do not use vp after mount_domount() call as it sets it to NULL on success.
This fixes a panic when starting extended attributes.

diffstat:

 sys/kern/vfs_syscalls.c |  18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diffs (65 lines):

diff -r 435544e13d7c -r 7fd791069449 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Sat Apr 28 17:27:08 2012 +0000
+++ b/sys/kern/vfs_syscalls.c   Sat Apr 28 17:30:19 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.451 2012/04/17 19:15:15 christos Exp $      */
+/*     $NetBSD: vfs_syscalls.c,v 1.452 2012/04/28 17:30:19 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.451 2012/04/17 19:15:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.452 2012/04/28 17:30:19 manu Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -273,20 +273,20 @@
 
        if ((error == 0) && !(saved_flags & MNT_EXTATTR) && 
            (flags & MNT_EXTATTR)) {
-               if (VFS_EXTATTRCTL(vp->v_mount, EXTATTR_CMD_START, 
+               if (VFS_EXTATTRCTL(mp, EXTATTR_CMD_START, 
                                   NULL, 0, NULL) != 0) {
                        printf("%s: failed to start extattr, error = %d",
-                              vp->v_mount->mnt_stat.f_mntonname, error);
+                              mp->mnt_stat.f_mntonname, error);
                        mp->mnt_flag &= ~MNT_EXTATTR;
                }
        }
 
        if ((error == 0) && (saved_flags & MNT_EXTATTR) && 
            !(flags & MNT_EXTATTR)) {
-               if (VFS_EXTATTRCTL(vp->v_mount, EXTATTR_CMD_STOP, 
+               if (VFS_EXTATTRCTL(mp, EXTATTR_CMD_STOP, 
                                   NULL, 0, NULL) != 0) {
                        printf("%s: failed to stop extattr, error = %d",
-                              vp->v_mount->mnt_stat.f_mntonname, error);
+                              mp->mnt_stat.f_mntonname, error);
                        mp->mnt_flag |= MNT_RDONLY;
                }
        }
@@ -458,6 +458,8 @@
        } else if (flags & MNT_UPDATE) {
                error = mount_update(l, vp, path, flags, data_buf, &data_len);
        } else {
+               struct mount *mp = vp->v_mount;
+
                /* Locking is handled internally in mount_domount(). */
                KASSERT(vfsopsrele == true);
                error = mount_domount(l, &vp, vfsops, path, flags, data_buf,
@@ -465,10 +467,10 @@
                vfsopsrele = false;
 
                if ((error == 0) && (flags & MNT_EXTATTR)) {
-                       if (VFS_EXTATTRCTL(vp->v_mount, EXTATTR_CMD_START, 
+                       if (VFS_EXTATTRCTL(mp, EXTATTR_CMD_START, 
                                           NULL, 0, NULL) != 0)
                                printf("%s: failed to start extattr",
-                                      vp->v_mount->mnt_stat.f_mntonname);
+                                      mp->mnt_stat.f_mntonname);
                                /* XXX remove flag */
                }
        }



Home | Main Index | Thread Index | Old Index