Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jan 2010 15:16:52 -0500
From:      jhell <jhell@DataIX.net>
To:        John Baldwin <jhb@freebsd.org>
Cc:        svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   Re: svn commit: r202750 - in stable/7/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/md fs/cd9660 fs/udf kern sys ufs/ffs
Message-ID:  <alpine.BSF.2.00.1001211513500.84229@pragry.qngnvk.ybpny>
In-Reply-To: <201001211433.o0LEXIFC054459@svn.freebsd.org>
References:  <201001211433.o0LEXIFC054459@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

Builds for stable/7 are broke by this commit with the folling error.

cc -O2 -fno-strict-aliasing -pipe -DFREEBSD_NAMECACHE -DBUILDING_ZFS 
-D_KERNEL -DKLD_MODULE -std=c99 -nostdinc 
-I/usr/src/sys/modules/zfs/../../cddl/compat/opensolaris 
-I/usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs 
-I/usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/zmod 
-I/usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common 
-I/usr/src/sys/modules/zfs/../.. 
-I/usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/common/zfs 
-I/usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/common 
-I/usr/src/sys/modules/zfs/../../../include -DHAVE_KERNEL_OPTION_HEADERS 
-include /usr/obj/usr/src/sys/SH4500/opt_global.h -I. -I@ -I@/contrib/altq 
-finline-limit=8000 --param inline-unit-growth=100 --param 
large-function-growth=1000 -fno-common -g -I/usr/obj/usr/src/sys/SH4500 
-mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow 
-mno-sse -mno-sse2 -mno-sse3 -ffreestanding -Wall -Wredundant-decls 
-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith 
-Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions 
-Wno-unknown-pragmas -Wno-missing-prototypes -Wno-undef 
-Wno-strict-prototypes -Wno-cast-qual -Wno-parentheses 
-Wno-redundant-decls -Wno-missing-braces -Wno-uninitialized -Wno-unused 
-Wno-inline -Wno-switch -Wno-pointer-arith -c 
/usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c 
/usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c: 
In function 'zfs_create_fs': 
/usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c:1523: 
error: 'vp' undeclared (first use in this function) 
/usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c:1523: 
error: (Each undeclared identifier is reported only once 
/usr/src/sys/modules/zfs/../../cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c:1523: 
error: for each function it appears in.) *** Error code 1

Stop in /usr/src/sys/modules/zfs.
*** Error code 1

Stop in /usr/src/sys/modules.
*** Error code 1

On Thu, 21 Jan 2010 09:33, jhb@ wrote: > Author: jhb > Date: Thu Jan 21 14:33:18 2010
> New Revision: 202750
> URL: http://svn.freebsd.org/changeset/base/202750
>
> Log:
>  MFC 189696,189697:
>  Add a new internal mount flag (MNTK_EXTENDED_SHARED) to indicate that a
>  filesystem supports additional operations using shared vnode locks.
>  Currently this is used to enable shared locks for open() and close() of
>  read-only file descriptors.
>  - When an ISOPEN namei() request is performed with LOCKSHARED, use a
>    shared vnode lock for the leaf vnode only if the mount point has the
>    extended shared flag set.
>  - Set LOCKSHARED in vn_open_cred() for requests that specify O_RDONLY but
>    not O_CREAT.
>  - Use a shared vnode lock around VOP_CLOSE() if the file was opened with
>    O_RDONLY and the mountpoint has the extended shared flag set.
>  - Adjust md(4) to upgrade the vnode lock on the vnode it gets back from
>    vn_open() since it now may only have a shared vnode lock.
>  - Don't enable shared vnode locks on FIFO vnodes in ZFS and UFS since
>    FIFO's require exclusive vnode locks for their open() and close()
>    routines.  (My recent MPSAFE patches for UDF and cd9660 already included
>    this change.)
>  - Enable extended shared operations on UFS, cd9660, and UDF.
>
> Modified:
>  stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
>  stable/7/sys/dev/md/md.c
>  stable/7/sys/fs/cd9660/cd9660_vfsops.c
>  stable/7/sys/fs/udf/udf_vfsops.c
>  stable/7/sys/kern/vfs_lookup.c
>  stable/7/sys/kern/vfs_vnops.c
>  stable/7/sys/kern/vnode_if.src
>  stable/7/sys/sys/mount.h
>  stable/7/sys/ufs/ffs/ffs_vfsops.c
> Directory Properties:
>  stable/7/sys/   (props changed)
>  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
>  stable/7/sys/contrib/dev/acpica/   (props changed)
>  stable/7/sys/contrib/pf/   (props changed)
>
> Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
> ==============================================================================
> --- stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c	Thu Jan 21 13:31:41 2010	(r202749)
> +++ stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c	Thu Jan 21 14:33:18 2010	(r202750)
> @@ -1520,6 +1520,7 @@ zfs_create_fs(objset_t *os, cred_t *cr,
> 	vnode.v_type = VDIR;
> 	vnode.v_data = rootzp;
> 	rootzp->z_vnode = &vnode;
> +	VN_LOCK_ASHARE(vp);
>
> 	bzero(&zfsvfs, sizeof (zfsvfs_t));
>
>
> Modified: stable/7/sys/dev/md/md.c
> ==============================================================================
> --- stable/7/sys/dev/md/md.c	Thu Jan 21 13:31:41 2010	(r202749)
> +++ stable/7/sys/dev/md/md.c	Thu Jan 21 14:33:18 2010	(r202750)
> @@ -918,12 +918,20 @@ mdcreate_vnode(struct md_s *sc, struct m
> 		return (error);
> 	vfslocked = NDHASGIANT(&nd);
> 	NDFREE(&nd, NDF_ONLY_PNBUF);
> -	if (nd.ni_vp->v_type != VREG ||
> -	    (error = VOP_GETATTR(nd.ni_vp, &vattr, td->td_ucred, td))) {
> -		VOP_UNLOCK(nd.ni_vp, 0, td);
> -		(void)vn_close(nd.ni_vp, flags, td->td_ucred, td);
> -		VFS_UNLOCK_GIANT(vfslocked);
> -		return (error ? error : EINVAL);
> +	if (nd.ni_vp->v_type != VREG) {
> +		error = EINVAL;
> +		goto bad;
> +	}
> +	error = VOP_GETATTR(nd.ni_vp, &vattr, td->td_ucred, td);
> +	if (error != 0)
> +		goto bad;
> +	if (VOP_ISLOCKED(nd.ni_vp, td) != LK_EXCLUSIVE) {
> +		vn_lock(nd.ni_vp, LK_UPGRADE | LK_RETRY, td);
> +		if (nd.ni_vp->v_iflag & VI_DOOMED) {
> +			/* Forced unmount. */
> +			error = EBADF;
> +			goto bad;
> +		}
> 	}
> 	nd.ni_vp->v_vflag |= VV_MD;
> 	VOP_UNLOCK(nd.ni_vp, 0, td);
> @@ -942,13 +950,15 @@ mdcreate_vnode(struct md_s *sc, struct m
> 		sc->vnode = NULL;
> 		vn_lock(nd.ni_vp, LK_EXCLUSIVE | LK_RETRY, td);
> 		nd.ni_vp->v_vflag &= ~VV_MD;
> -		VOP_UNLOCK(nd.ni_vp, 0, td);
> -		(void)vn_close(nd.ni_vp, flags, td->td_ucred, td);
> -		VFS_UNLOCK_GIANT(vfslocked);
> -		return (error);
> +		goto bad;
> 	}
> 	VFS_UNLOCK_GIANT(vfslocked);
> 	return (0);
> +bad:
> +	VOP_UNLOCK(nd.ni_vp, 0, td);
> +	(void)vn_close(nd.ni_vp, flags, td->td_ucred, td);
> +	VFS_UNLOCK_GIANT(vfslocked);
> +	return (error);
> }
>
> static int
>
> Modified: stable/7/sys/fs/cd9660/cd9660_vfsops.c
> ==============================================================================
> --- stable/7/sys/fs/cd9660/cd9660_vfsops.c	Thu Jan 21 13:31:41 2010	(r202749)
> +++ stable/7/sys/fs/cd9660/cd9660_vfsops.c	Thu Jan 21 14:33:18 2010	(r202750)
> @@ -373,7 +373,8 @@ iso_mountfs(devvp, mp, td)
> 	mp->mnt_maxsymlinklen = 0;
> 	MNT_ILOCK(mp);
> 	mp->mnt_flag |= MNT_LOCAL;
> -	mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED;
> +	mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED |
> +	    MNTK_EXTENDED_SHARED;
> 	MNT_IUNLOCK(mp);
> 	isomp->im_mountp = mp;
> 	isomp->im_dev = dev;
>
> Modified: stable/7/sys/fs/udf/udf_vfsops.c
> ==============================================================================
> --- stable/7/sys/fs/udf/udf_vfsops.c	Thu Jan 21 13:31:41 2010	(r202749)
> +++ stable/7/sys/fs/udf/udf_vfsops.c	Thu Jan 21 14:33:18 2010	(r202750)
> @@ -353,7 +353,8 @@ udf_mountfs(struct vnode *devvp, struct
> 	mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
> 	MNT_ILOCK(mp);
> 	mp->mnt_flag |= MNT_LOCAL;
> -	mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED;
> +	mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED |
> +	    MNTK_EXTENDED_SHARED;
> 	MNT_IUNLOCK(mp);
> 	udfmp->im_mountp = mp;
> 	udfmp->im_dev = dev;
>
> Modified: stable/7/sys/kern/vfs_lookup.c
> ==============================================================================
> --- stable/7/sys/kern/vfs_lookup.c	Thu Jan 21 13:31:41 2010	(r202749)
> +++ stable/7/sys/kern/vfs_lookup.c	Thu Jan 21 14:33:18 2010	(r202750)
> @@ -322,6 +322,41 @@ compute_cn_lkflags(struct mount *mp, int
> 	return lkflags;
> }
>
> +static __inline int
> +needs_exclusive_leaf(struct mount *mp, int flags)
> +{
> +
> +	/*
> +	 * Intermediate nodes can use shared locks, we only need to
> +	 * force an exclusive lock for leaf nodes.
> +	 */
> +	if ((flags & (ISLASTCN | LOCKLEAF)) != (ISLASTCN | LOCKLEAF))
> +		return (0);
> +
> +	/* Always use exclusive locks if LOCKSHARED isn't set. */
> +	if (!(flags & LOCKSHARED))
> +		return (1);
> +
> +	/*
> +	 * For lookups during open(), if the mount point supports
> +	 * extended shared operations, then use a shared lock for the
> +	 * leaf node, otherwise use an exclusive lock.
> +	 */
> +	if (flags & ISOPEN) {
> +		if (mp != NULL &&
> +		    (mp->mnt_kern_flag & MNTK_EXTENDED_SHARED))
> +			return (0);
> +		else
> +			return (1);
> +	}
> +
> +	/*
> +	 * Lookup requests outside of open() that specify LOCKSHARED
> +	 * only need a shared lock on the leaf vnode.
> +	 */
> +	return (0);
> +}
> +
> /*
>  * Search a pathname.
>  * This is a very central and rather complicated routine.
> @@ -580,8 +615,7 @@ unionlookup:
> 	 * If we're looking up the last component and we need an exclusive
> 	 * lock, adjust our lkflags.
> 	 */
> -	if ((cnp->cn_flags & (ISLASTCN|LOCKSHARED|LOCKLEAF)) ==
> -	    (ISLASTCN|LOCKLEAF))
> +	if (needs_exclusive_leaf(dp->v_mount, cnp->cn_flags))
> 		cnp->cn_lkflags = LK_EXCLUSIVE;
> #ifdef NAMEI_DIAGNOSTIC
> 	vprint("lookup in", dp);
> @@ -778,8 +812,8 @@ success:
> 	 * Because of lookup_shared we may have the vnode shared locked, but
> 	 * the caller may want it to be exclusively locked.
> 	 */
> -	if ((cnp->cn_flags & (ISLASTCN | LOCKSHARED | LOCKLEAF)) ==
> -	    (ISLASTCN | LOCKLEAF) && VOP_ISLOCKED(dp, td) != LK_EXCLUSIVE) {
> +	if (needs_exclusive_leaf(dp->v_mount, cnp->cn_flags) &&
> +	    VOP_ISLOCKED(dp, td) != LK_EXCLUSIVE) {
> 		vn_lock(dp, LK_UPGRADE | LK_RETRY, td);
> 		if (dp->v_iflag & VI_DOOMED) {
> 			error = ENOENT;
>
> Modified: stable/7/sys/kern/vfs_vnops.c
> ==============================================================================
> --- stable/7/sys/kern/vfs_vnops.c	Thu Jan 21 13:31:41 2010	(r202749)
> +++ stable/7/sys/kern/vfs_vnops.c	Thu Jan 21 14:33:18 2010	(r202750)
> @@ -185,6 +185,8 @@ restart:
> 		ndp->ni_cnd.cn_flags = ISOPEN |
> 		    ((fmode & O_NOFOLLOW) ? NOFOLLOW : FOLLOW) |
> 		    LOCKLEAF | MPSAFE | AUDITVNODE1;
> +		if (!(fmode & FWRITE))
> +			ndp->ni_cnd.cn_flags |= LOCKSHARED;
> 		if ((error = namei(ndp)) != 0)
> 			return (error);
> 		if (!mpsafe)
> @@ -235,7 +237,7 @@ restart:
> 	if (fmode & FWRITE)
> 		vp->v_writecount++;
> 	*flagp = fmode;
> -	ASSERT_VOP_ELOCKED(vp, "vn_open_cred");
> +	ASSERT_VOP_LOCKED(vp, "vn_open_cred");
> 	if (!mpsafe)
> 		VFS_UNLOCK_GIANT(vfslocked);
> 	return (0);
> @@ -280,12 +282,18 @@ vn_close(vp, flags, file_cred, td)
> 	struct thread *td;
> {
> 	struct mount *mp;
> -	int error;
> +	int error, lock_flags;
> +
> +	if (!(flags & FWRITE) && vp->v_mount != NULL &&
> +	    vp->v_mount->mnt_kern_flag & MNTK_EXTENDED_SHARED)
> +		lock_flags = LK_SHARED;
> +	else
> +		lock_flags = LK_EXCLUSIVE;
>
> 	VFS_ASSERT_GIANT(vp->v_mount);
>
> 	vn_start_write(vp, &mp, V_WAIT);
> -	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
> +	vn_lock(vp, lock_flags | LK_RETRY, td);
> 	if (flags & FWRITE) {
> 		VNASSERT(vp->v_writecount > 0, vp,
> 		    ("vn_close: negative writecount"));
>
> Modified: stable/7/sys/kern/vnode_if.src
> ==============================================================================
> --- stable/7/sys/kern/vnode_if.src	Thu Jan 21 13:31:41 2010	(r202749)
> +++ stable/7/sys/kern/vnode_if.src	Thu Jan 21 14:33:18 2010	(r202750)
> @@ -134,7 +134,7 @@ vop_open {
> };
>
>
> -%% close	vp	E E E
> +%% close	vp	L L L
>
> vop_close {
> 	IN struct vnode *vp;
>
> Modified: stable/7/sys/sys/mount.h
> ==============================================================================
> --- stable/7/sys/sys/mount.h	Thu Jan 21 13:31:41 2010	(r202749)
> +++ stable/7/sys/sys/mount.h	Thu Jan 21 14:33:18 2010	(r202750)
> @@ -328,6 +328,7 @@ void          __mnt_vnode_markerfree(str
> #define MNTK_SOFTDEP	0x00000004	/* async disabled by softdep */
> #define MNTK_NOINSMNTQ	0x00000008	/* insmntque is not allowed */
> #define	MNTK_REFEXPIRE	0x00000020	/* refcount expiring is happening */
> +#define MNTK_EXTENDED_SHARED	0x00000040 /* Allow shared locking for more ops */
> #define	MNTK_SHARED_WRITES	0x00000080 /* Allow shared locking for writes */
> #define MNTK_UNMOUNT	0x01000000	/* unmount in progress */
> #define	MNTK_MWAIT	0x02000000	/* waiting for unmount to finish */
> @@ -335,8 +336,8 @@ void          __mnt_vnode_markerfree(str
> #define	MNTK_SUSPEND2	0x04000000	/* block secondary writes */
> #define	MNTK_SUSPENDED	0x10000000	/* write operations are suspended */
> #define	MNTK_MPSAFE	0x20000000	/* Filesystem is MPSAFE. */
> -#define	MNTK_NOKNOTE	0x80000000	/* Don't send KNOTEs from VOP hooks */
> #define MNTK_LOOKUP_SHARED	0x40000000 /* FS supports shared lock lookups */
> +#define	MNTK_NOKNOTE	0x80000000	/* Don't send KNOTEs from VOP hooks */
>
> /*
>  * Sysctl CTL_VFS definitions.
>
> Modified: stable/7/sys/ufs/ffs/ffs_vfsops.c
> ==============================================================================
> --- stable/7/sys/ufs/ffs/ffs_vfsops.c	Thu Jan 21 13:31:41 2010	(r202749)
> +++ stable/7/sys/ufs/ffs/ffs_vfsops.c	Thu Jan 21 14:33:18 2010	(r202750)
> @@ -883,7 +883,8 @@ ffs_mountfs(devvp, mp, td)
> 	 * Initialize filesystem stat information in mount struct.
> 	 */
> 	MNT_ILOCK(mp);
> -	mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED;
> +	mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED |
> +	    MNTK_EXTENDED_SHARED;
> 	MNT_IUNLOCK(mp);
> #ifdef UFS_EXTATTR
> #ifdef UFS_EXTATTR_AUTOSTART
> @@ -1440,10 +1441,9 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags
> 		return (error);
> 	}
> 	/*
> -	 * FFS supports recursive and shared locking.
> +	 * FFS supports recursive locking.
> 	 */
> -	vp->v_vnlock->lk_flags |= LK_CANRECURSE;
> -	vp->v_vnlock->lk_flags &= ~LK_NOSHARE;
> +	VN_LOCK_AREC(vp);
> 	vp->v_data = ip;
> 	vp->v_bufobj.bo_bsize = fs->fs_bsize;
> 	ip->i_vnode = vp;
> @@ -1518,6 +1518,10 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags
> 	/*
> 	 * Finish inode initialization.
> 	 */
> +	if (vp->v_type != VFIFO) {
> +		/* FFS supports shared locking for all files except fifos. */
> +		VN_LOCK_ASHARE(vp);
> +	}
>
> 	/*
> 	 * Set up a generation number for this inode if it does not
> _______________________________________________
> svn-src-stable-7@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7
> To unsubscribe, send any mail to "svn-src-stable-7-unsubscribe@freebsd.org"
>




-- 

  jhell




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1001211513500.84229>