Module Name:    src
Committed By:   riz
Date:           Sat May 19 15:01:36 UTC 2012

Modified Files:
        src/sys/kern [netbsd-6]: vfs_mount.c vfs_syscalls.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #259):
        sys/kern/vfs_syscalls.c: revision 1.456
        sys/kern/vfs_mount.c: revision 1.14
        sys/kern/vfs_syscalls.c: revision 1.452
        sys/kern/vfs_syscalls.c: revision 1.453
        sys/kern/vfs_syscalls.c: revision 1.454
Do not use vp after mount_domount() call as it sets it to NULL on success.
This fixes a panic when starting extended attributes.
Fix mount -o extattr : previous patch fixed a panic but caused operation
to happen on the mount point instead of the mounted filesystem.
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.
Move VFS_EXTATTRCTL to mount_domount().  This makes the
fs/puffs/t_fuzz:mountfuzz7, fs/puffs/t_fuzz:mountfuzz8,
and fs/zfs/t_zpool:create tests pass again.  Patch from
manu, discussed on tech-kern and committed at his request.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.6.1 src/sys/kern/vfs_mount.c
cvs rdiff -u -r1.449.2.1 -r1.449.2.2 src/sys/kern/vfs_syscalls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.12 src/sys/kern/vfs_mount.c:1.12.6.1
--- src/sys/kern/vfs_mount.c:1.12	Fri Nov 18 21:17:45 2011
+++ src/sys/kern/vfs_mount.c	Sat May 19 15:01:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.12 2011/11/18 21:17:45 christos Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.12.6.1 2012/05/19 15:01:35 riz Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.12 2011/11/18 21:17:45 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.12.6.1 2012/05/19 15:01:35 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -83,6 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,
 #include <sys/module.h>
 #include <sys/mount.h>
 #include <sys/namei.h>
+#include <sys/extattr.h>
 #include <sys/syscallargs.h>
 #include <sys/sysctl.h>
 #include <sys/systm.h>
@@ -758,8 +759,15 @@ mount_domount(struct lwp *l, vnode_t **v
 	vfs_unbusy(mp, true, NULL);
 	(void) VFS_STATVFS(mp, &mp->mnt_stat);
 	error = VFS_START(mp, 0);
-	if (error)
+       if (error) {
 		vrele(vp);
+       } else if (flags & MNT_EXTATTR) {
+	       error = VFS_EXTATTRCTL(vp->v_mountedhere, 
+		   EXTATTR_CMD_START, NULL, 0, NULL);
+	       if (error) 
+		       printf("%s: failed to start extattr: error = %d\n",
+			   vp->v_mountedhere->mnt_stat.f_mntonname, error);
+       }
 	/* Drop reference held for VFS_START(). */
 	vfs_destroy(mp);
 	*vpp = NULL;

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.449.2.1 src/sys/kern/vfs_syscalls.c:1.449.2.2
--- src/sys/kern/vfs_syscalls.c:1.449.2.1	Thu May 17 18:12:12 2012
+++ src/sys/kern/vfs_syscalls.c	Sat May 19 15:01:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.449.2.1 2012/05/17 18:12:12 riz Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.449.2.2 2012/05/19 15:01:35 riz 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.449.2.1 2012/05/17 18:12:12 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.449.2.2 2012/05/19 15:01:35 riz Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -273,20 +273,20 @@ mount_update(struct lwp *l, struct vnode
 
 	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;
 		}
 	}
@@ -463,14 +463,6 @@ do_sys_mount(struct lwp *l, struct vfsop
 		error = mount_domount(l, &vp, vfsops, path, flags, data_buf,
 		    &data_len);
 		vfsopsrele = false;
-
-		if ((error == 0) && (flags & MNT_EXTATTR)) {
-			if (VFS_EXTATTRCTL(vp->v_mount, EXTATTR_CMD_START, 
-					   NULL, 0, NULL) != 0)
-				printf("%s: failed to start extattr",
-				       vp->v_mount->mnt_stat.f_mntonname);
-				/* XXX remove flag */
-		}
 	}
 
     done:

Reply via email to