CVS commit: [netbsd-5] src/sys/ufs/ufs

2012-05-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue May 22 21:44:38 UTC 2012

Modified Files:
src/sys/ufs/ufs [netbsd-5]: ufs_vnops.c

Log Message:
Pull up following patch (requested by buhrow in ticket #1763):
sys/ufs/ufs/ufs_vnops.c: patch

Make sure we return EXDEV on cross-device links rather than panicing
the system.  This corrects a pasting error from the merged patches
in ticket 1759.

Thanks to hannken@ for figuring out the error.
Fixes pr kern/46472
Tested by buhrow@


To generate a diff of this commit:
cvs rdiff -u -r1.169.4.2 -r1.169.4.3 src/sys/ufs/ufs/ufs_vnops.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/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.169.4.2 src/sys/ufs/ufs/ufs_vnops.c:1.169.4.3
--- src/sys/ufs/ufs/ufs_vnops.c:1.169.4.2	Sat May 19 17:28:29 2012
+++ src/sys/ufs/ufs/ufs_vnops.c	Tue May 22 21:44:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vnops.c,v 1.169.4.2 2012/05/19 17:28:29 riz Exp $	*/
+/*	$NetBSD: ufs_vnops.c,v 1.169.4.3 2012/05/22 21:44:38 riz Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.169.4.2 2012/05/19 17:28:29 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.169.4.3 2012/05/22 21:44:38 riz Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1387,6 +1387,7 @@ ufs_rename(void *v)
 	 */
  	if (fdvp->v_mount != tdvp->v_mount) {
 		error = EXDEV;
+		goto abort;
 	}
 
 	/*



CVS commit: [netbsd-5] src/sys/ufs/ufs

2011-09-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Sep 17 18:51:34 UTC 2011

Modified Files:
src/sys/ufs/ufs [netbsd-5]: ufs_extattr.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #1664):
sys/ufs/ufs/ufs_extattr.c: revision 1.35
Fix locking protocol to avoid a panic on extattrctl stop and on umount.


To generate a diff of this commit:
cvs rdiff -u -r1.21.14.3 -r1.21.14.4 src/sys/ufs/ufs/ufs_extattr.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/ufs/ufs/ufs_extattr.c
diff -u src/sys/ufs/ufs/ufs_extattr.c:1.21.14.3 src/sys/ufs/ufs/ufs_extattr.c:1.21.14.4
--- src/sys/ufs/ufs/ufs_extattr.c:1.21.14.3	Sun Jul 17 15:36:04 2011
+++ src/sys/ufs/ufs/ufs_extattr.c	Sat Sep 17 18:51:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_extattr.c,v 1.21.14.3 2011/07/17 15:36:04 riz Exp $	*/
+/*	$NetBSD: ufs_extattr.c,v 1.21.14.4 2011/09/17 18:51:34 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1999-2002 Robert N. M. Watson
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.21.14.3 2011/07/17 15:36:04 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.21.14.4 2011/09/17 18:51:34 bouyer Exp $");
 
 #include "opt_ffs.h"
 
@@ -130,6 +130,7 @@
 	if (ump->um_extattr.uepm_lockcnt != 0) {
 		KASSERT(mutex_owned(&ump->um_extattr.uepm_lock));
 		ump->um_extattr.uepm_lockcnt--;
+		return;
 	}
 	mutex_exit(&ump->um_extattr.uepm_lock);
 }



CVS commit: [netbsd-5] src/sys/ufs/ufs

2011-07-15 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Jul 16 00:19:13 UTC 2011

Modified Files:
src/sys/ufs/ufs [netbsd-5]: ufs_inode.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #1642):
sys/ufs/ufs/ufs_inode.c: revision 1.86
Call ufs_extattr_vnode_inactive before UFS_WAPBL_BEGIN, as the latter will
leave the vnode locked, and ufs_extattr_vnode_inactive does lock/unlock


To generate a diff of this commit:
cvs rdiff -u -r1.76.4.4 -r1.76.4.5 src/sys/ufs/ufs/ufs_inode.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/ufs/ufs/ufs_inode.c
diff -u src/sys/ufs/ufs/ufs_inode.c:1.76.4.4 src/sys/ufs/ufs/ufs_inode.c:1.76.4.5
--- src/sys/ufs/ufs/ufs_inode.c:1.76.4.4	Tue Sep  7 19:33:35 2010
+++ src/sys/ufs/ufs/ufs_inode.c	Sat Jul 16 00:19:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_inode.c,v 1.76.4.4 2010/09/07 19:33:35 bouyer Exp $	*/
+/*	$NetBSD: ufs_inode.c,v 1.76.4.5 2011/07/16 00:19:13 riz Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.76.4.4 2010/09/07 19:33:35 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.76.4.5 2011/07/16 00:19:13 riz Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -102,6 +102,9 @@
 		softdep_releasefile(ip);
 
 	if (ip->i_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
+#ifdef UFS_EXTATTR
+		ufs_extattr_vnode_inactive(vp, curlwp);
+#endif
 		error = UFS_WAPBL_BEGIN(vp->v_mount);
 		if (error)
 			goto out;
@@ -109,9 +112,6 @@
 #ifdef QUOTA
 		(void)chkiq(ip, -1, NOCRED, 0);
 #endif
-#ifdef UFS_EXTATTR
-		ufs_extattr_vnode_inactive(vp, curlwp);
-#endif
 		if (ip->i_size != 0) {
 			/*
 			 * When journaling, only truncate one indirect block



CVS commit: [netbsd-5] src/sys/ufs/ufs

2011-06-18 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Jun 18 16:22:31 UTC 2011

Modified Files:
src/sys/ufs/ufs [netbsd-5]: ufs_extattr.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #1624):
sys/ufs/ufs/ufs_extattr.c: revision 1.29 via patch
Fix filesystem root leaked lock when using UFS_EXTATTR_AUTOSTART.
This way, statvfs(2) calls obtained by df(1) or umount(8) will no
longer sleep forever in the kernel to acquire the lock.


To generate a diff of this commit:
cvs rdiff -u -r1.21.14.1 -r1.21.14.2 src/sys/ufs/ufs/ufs_extattr.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/ufs/ufs/ufs_extattr.c
diff -u src/sys/ufs/ufs/ufs_extattr.c:1.21.14.1 src/sys/ufs/ufs/ufs_extattr.c:1.21.14.2
--- src/sys/ufs/ufs/ufs_extattr.c:1.21.14.1	Fri May 20 19:30:09 2011
+++ src/sys/ufs/ufs/ufs_extattr.c	Sat Jun 18 16:22:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_extattr.c,v 1.21.14.1 2011/05/20 19:30:09 bouyer Exp $	*/
+/*	$NetBSD: ufs_extattr.c,v 1.21.14.2 2011/06/18 16:22:31 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1999-2002 Robert N. M. Watson
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.21.14.1 2011/05/20 19:30:09 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.21.14.2 2011/06/18 16:22:31 bouyer Exp $");
 
 #include "opt_ffs.h"
 
@@ -284,7 +284,8 @@
 	error = ufs_lookup(&vargs);
 	PNBUF_PUT(cnp.cn_pnbuf);
 	if (error) {
-		VOP_UNLOCK(start_dvp, 0);
+		if (lockparent == 0)
+			VOP_UNLOCK(start_dvp, 0);
 		return (error);
 	}
 #if 0
@@ -292,6 +293,10 @@
 		panic("ufs_extattr_lookup: target_vp == start_dvp");
 #endif
 
+	if ((target_vp != start_dvp) && (lockparent == 0))
+		VOP_UNLOCK(start_dvp, 0);
+
+
 	KASSERT(VOP_ISLOCKED(target_vp) == LK_EXCLUSIVE);
 	*vp = target_vp;
 	return (0);



CVS commit: [netbsd-5] src/sys/ufs/ufs

2011-05-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri May 20 19:30:10 UTC 2011

Modified Files:
src/sys/ufs/ufs [netbsd-5]: ufs_extattr.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #1619):
sys/ufs/ufs/ufs_extattr.c: revision 1.26 via patch
The lwp member of struct componentname was removed a long time ago.
Fix broken build with UFS_EXTATTR_AUTOSTART by removing it here as well.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.14.1 src/sys/ufs/ufs/ufs_extattr.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/ufs/ufs/ufs_extattr.c
diff -u src/sys/ufs/ufs/ufs_extattr.c:1.21 src/sys/ufs/ufs/ufs_extattr.c:1.21.14.1
--- src/sys/ufs/ufs/ufs_extattr.c:1.21	Fri Mar 21 21:55:01 2008
+++ src/sys/ufs/ufs/ufs_extattr.c	Fri May 20 19:30:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_extattr.c,v 1.21 2008/03/21 21:55:01 ad Exp $	*/
+/*	$NetBSD: ufs_extattr.c,v 1.21.14.1 2011/05/20 19:30:09 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1999-2002 Robert N. M. Watson
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.21 2008/03/21 21:55:01 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.21.14.1 2011/05/20 19:30:09 bouyer Exp $");
 
 #include "opt_ffs.h"
 
@@ -263,7 +263,6 @@
 	memset(&cnp, 0, sizeof(cnp));
 	cnp.cn_nameiop = LOOKUP;
 	cnp.cn_flags = ISLASTCN | lockparent;
-	cnp.cn_lwp = l;
 	cnp.cn_cred = l->l_cred;
 	cnp.cn_pnbuf = PNBUF_GET();
 	cnp.cn_nameptr = cnp.cn_pnbuf;



CVS commit: [netbsd-5] src/sys/ufs/ufs

2010-03-28 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Mar 28 17:31:55 UTC 2010

Modified Files:
src/sys/ufs/ufs [netbsd-5]: ufs_vnops.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1345):
sys/ufs/ufs/ufs_vnops.c: revision 1.180 via patch
ufs_rmdir(): move fstrans_done() after vput().  No more unlinked and
zero-sized directory inodes in snapshots.


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.169.4.1 src/sys/ufs/ufs/ufs_vnops.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/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.169 src/sys/ufs/ufs/ufs_vnops.c:1.169.4.1
--- src/sys/ufs/ufs/ufs_vnops.c:1.169	Thu Aug 14 16:19:25 2008
+++ src/sys/ufs/ufs/ufs_vnops.c	Sun Mar 28 17:31:55 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vnops.c,v 1.169 2008/08/14 16:19:25 matt Exp $	*/
+/*	$NetBSD: ufs_vnops.c,v 1.169.4.1 2010/03/28 17:31:55 snj Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.169 2008/08/14 16:19:25 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.169.4.1 2010/03/28 17:31:55 snj Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1683,7 +1683,6 @@
 #endif
  out:
 	VN_KNOTE(vp, NOTE_DELETE);
-	fstrans_done(dvp->v_mount);
 	pace = DOINGSOFTDEP(dvp);
 	vput(dvp);
 	vput(vp);
@@ -1694,6 +1693,7 @@
 		 */
 		softdep_pace_dirrem();
 	}
+	fstrans_done(dvp->v_mount);
 	return (error);
 }
 



CVS commit: [netbsd-5] src/sys/ufs/ufs

2010-03-28 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Mar 28 17:29:41 UTC 2010

Modified Files:
src/sys/ufs/ufs [netbsd-5]: ufs_inode.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1345):
sys/ufs/ufs/ufs_inode.c: revision 1.80
Allow ufs_inactive() while a file system is suspending.  Removes a possible
deadlock between vrele() and ffs_sync() during suspension.


To generate a diff of this commit:
cvs rdiff -u -r1.76.4.2 -r1.76.4.3 src/sys/ufs/ufs/ufs_inode.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/ufs/ufs/ufs_inode.c
diff -u src/sys/ufs/ufs/ufs_inode.c:1.76.4.2 src/sys/ufs/ufs/ufs_inode.c:1.76.4.3
--- src/sys/ufs/ufs/ufs_inode.c:1.76.4.2	Mon Feb 22 04:43:47 2010
+++ src/sys/ufs/ufs/ufs_inode.c	Sun Mar 28 17:29:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_inode.c,v 1.76.4.2 2010/02/22 04:43:47 snj Exp $	*/
+/*	$NetBSD: ufs_inode.c,v 1.76.4.3 2010/03/28 17:29:41 snj Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.76.4.2 2010/02/22 04:43:47 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.76.4.3 2010/03/28 17:29:41 snj Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -92,7 +92,7 @@
 	UFS_WAPBL_JUNLOCK_ASSERT(vp->v_mount);
 
 	transmp = vp->v_mount;
-	fstrans_start(transmp, FSTRANS_SHARED);
+	fstrans_start(transmp, FSTRANS_LAZY);
 	/*
 	 * Ignore inodes related to stale file handles.
 	 */



CVS commit: [netbsd-5] src/sys/ufs/ufs

2010-02-14 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Feb 14 13:55:29 UTC 2010

Modified Files:
src/sys/ufs/ufs [netbsd-5]: ufs_lookup.c

Log Message:
Pull up following revision(s) (requested by dholland in ticket #1300):
sys/ufs/ufs/ufs_lookup.c: revision 1.102
Avoid nasal demons. Code of the form
   vput(vp);
   error = VFS_VGET(vp->v_mount, ...);
just isn't right. Because of vnode caching this *probably* never bit
anyone, except maybe under very heavy load, but still.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.99.4.1 src/sys/ufs/ufs/ufs_lookup.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/ufs/ufs/ufs_lookup.c
diff -u src/sys/ufs/ufs/ufs_lookup.c:1.99 src/sys/ufs/ufs/ufs_lookup.c:1.99.4.1
--- src/sys/ufs/ufs/ufs_lookup.c:1.99	Thu Jul 31 05:38:06 2008
+++ src/sys/ufs/ufs/ufs_lookup.c	Sun Feb 14 13:55:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_lookup.c,v 1.99 2008/07/31 05:38:06 simonb Exp $	*/
+/*	$NetBSD: ufs_lookup.c,v 1.99.4.1 2010/02/14 13:55:29 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.99 2008/07/31 05:38:06 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.99.4.1 2010/02/14 13:55:29 bouyer Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ffs.h"
@@ -1256,7 +1256,7 @@
 int
 ufs_checkpath(struct inode *source, struct inode *target, kauth_cred_t cred)
 {
-	struct vnode *vp = ITOV(target);
+	struct vnode *nextvp, *vp;
 	int error, rootino, namlen;
 	struct dirtemplate dirbuf;
 	const int needswap = UFS_MPNEEDSWAP(target->i_ump);
@@ -1304,13 +1304,15 @@
 		}
 		if (ufs_rw32(dirbuf.dotdot_ino, needswap) == rootino)
 			break;
-		vput(vp);
+		VOP_UNLOCK(vp, 0);
 		error = VFS_VGET(vp->v_mount,
-		ufs_rw32(dirbuf.dotdot_ino, needswap), &vp);
+		ufs_rw32(dirbuf.dotdot_ino, needswap), &nextvp);
+		vrele(vp);
 		if (error) {
 			vp = NULL;
 			break;
 		}
+		vp = nextvp;
 	}
 
 out:



CVS commit: [netbsd-5] src/sys/ufs/ufs

2010-01-27 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Jan 27 21:26:45 UTC 2010

Modified Files:
src/sys/ufs/ufs [netbsd-5]: ufs_quota.c

Log Message:
Pull up the following revisions(s) (requested by bouyer in ticket #1252):
sys/ufs/ufs/ufs_quota.c:revision 1.65

vclean() actually sets v_tag to VT_NON but doesn't touch v_type.
getcleanvnode() sets v_type to VNON after releasing v_interlock.
So the thread doing quotaon(), quotaoff() or qsync() could vget()
a vnode which is being recycled in getcleanvnode(), after it has
been cleaned and v_interlock released, but before v_type has been
reset, leading to KASSERT(vp->v_usecount == 1) firing in
getnewvnode(), or qsync() dereferencing a NULL pointer as in
PR kern/42205.
Fix by using the same tests as other ffs functions traversing the mount
list: also check for VTOI(vp) == NULL, and VI_XLOCK in addition
to VI_CLEAN.


To generate a diff of this commit:
cvs rdiff -u -r1.60.10.3 -r1.60.10.4 src/sys/ufs/ufs/ufs_quota.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/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.60.10.3 src/sys/ufs/ufs/ufs_quota.c:1.60.10.4
--- src/sys/ufs/ufs/ufs_quota.c:1.60.10.3	Fri Aug  7 05:59:44 2009
+++ src/sys/ufs/ufs/ufs_quota.c	Wed Jan 27 21:26:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.60.10.3 2009/08/07 05:59:44 snj Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.60.10.4 2010/01/27 21:26:45 sborrill Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.60.10.3 2009/08/07 05:59:44 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.60.10.4 2010/01/27 21:26:45 sborrill Exp $");
 
 #include 
 #include 
@@ -473,9 +473,9 @@
 	for (vp = TAILQ_FIRST(&mp->mnt_vnodelist); vp; vp = vunmark(mvp)) {
 		vmark(mvp, vp);
 		mutex_enter(&vp->v_interlock);
-		if (vp->v_mount != mp || vismarker(vp) ||
+		if (VTOI(vp) == NULL || vp->v_mount != mp || vismarker(vp) ||
 		vp->v_type == VNON || vp->v_writecount == 0 ||
-		(vp->v_iflag & VI_CLEAN) != 0) {
+		(vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0) {
 			mutex_exit(&vp->v_interlock);
 			continue;
 		}
@@ -543,8 +543,9 @@
 	for (vp = TAILQ_FIRST(&mp->mnt_vnodelist); vp; vp = vunmark(mvp)) {
 		vmark(mvp, vp);
 		mutex_enter(&vp->v_interlock);
-		if (vp->v_mount != mp || vismarker(vp) || vp->v_type == VNON ||
-		(vp->v_iflag & VI_CLEAN) != 0) {
+		if (VTOI(vp) == NULL || vp->v_mount != mp || vismarker(vp) ||
+		vp->v_type == VNON ||
+		(vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0) {
 			mutex_exit(&vp->v_interlock);
 			continue;
 		}
@@ -728,8 +729,9 @@
 	for (vp = TAILQ_FIRST(&mp->mnt_vnodelist); vp; vp = vunmark(mvp)) {
 		vmark(mvp, vp);
 		mutex_enter(&vp->v_interlock);
-		if (vp->v_mount != mp || vismarker(vp) || vp->v_type == VNON ||
-		(vp->v_iflag & VI_CLEAN) != 0) {
+		if (VTOI(vp) == NULL || vp->v_mount != mp || vismarker(vp) ||
+		vp->v_type == VNON ||
+		(vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0) {
 			mutex_exit(&vp->v_interlock);
 			continue;
 		}



CVS commit: [netbsd-5] src/sys/ufs/ufs

2009-09-27 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Sep 28 01:43:02 UTC 2009

Modified Files:
src/sys/ufs/ufs [netbsd-5]: ufs_ihash.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1029):
sys/ufs/ufs/ufs_ihash.c: revision 1.27
PR kern/41147: race between nfsd and local rm
Note that the race also exists between 2 nfs client, one of them doing the rm.
In ufs_ihashget(), vget() can return a vnode that has been vclean'ed because
vget() can sleep. After vget returns, check that vp is still connected with
ip, and that ip still points to the inode we want. This fix the NULL
pointer dereference in ufs_fhtovp() I've been seeing on a NFS server.
XXX I have no idea why using vput() instead of
vlockmgr(vp->v_vnlock, LK_RELEASE); vrele(vp); does not work.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.10.1 src/sys/ufs/ufs/ufs_ihash.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/ufs/ufs/ufs_ihash.c
diff -u src/sys/ufs/ufs/ufs_ihash.c:1.26 src/sys/ufs/ufs/ufs_ihash.c:1.26.10.1
--- src/sys/ufs/ufs/ufs_ihash.c:1.26	Mon May  5 17:11:17 2008
+++ src/sys/ufs/ufs/ufs_ihash.c	Mon Sep 28 01:43:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_ihash.c,v 1.26 2008/05/05 17:11:17 ad Exp $	*/
+/*	$NetBSD: ufs_ihash.c,v 1.26.10.1 2009/09/28 01:43:02 snj Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_ihash.c,v 1.26 2008/05/05 17:11:17 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_ihash.c,v 1.26.10.1 2009/09/28 01:43:02 snj Exp $");
 
 #include 
 #include 
@@ -152,6 +152,15 @@
 mutex_exit(&ufs_ihash_lock);
 if (vget(vp, flags | LK_INTERLOCK))
 	goto loop;
+if (VTOI(vp) != ip ||
+ip->i_number != inum || ip->i_dev != dev) {
+	/* lost race against vclean() */
+	if (vlockmgr(vp->v_vnlock, LK_RELEASE))
+		printf("can't release lock\n");
+	vrele(vp);
+	vp = NULL;
+	goto loop;
+}
 			}
 			return (vp);
 		}



CVS commit: [netbsd-5] src/sys/ufs/ufs

2009-08-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Aug  7 05:59:44 UTC 2009

Modified Files:
src/sys/ufs/ufs [netbsd-5]: ufs_quota.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #898):
sys/ufs/ufs/ufs_quota.c: revision 1.64
Fix previous: mutex_destroy() the right mutex


To generate a diff of this commit:
cvs rdiff -u -r1.60.10.2 -r1.60.10.3 src/sys/ufs/ufs/ufs_quota.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/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.60.10.2 src/sys/ufs/ufs/ufs_quota.c:1.60.10.3
--- src/sys/ufs/ufs/ufs_quota.c:1.60.10.2	Fri Aug  7 05:59:17 2009
+++ src/sys/ufs/ufs/ufs_quota.c	Fri Aug  7 05:59:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.60.10.2 2009/08/07 05:59:17 snj Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.60.10.3 2009/08/07 05:59:44 snj Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.60.10.2 2009/08/07 05:59:17 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.60.10.3 2009/08/07 05:59:44 snj Exp $");
 
 #include 
 #include 
@@ -887,7 +887,7 @@
 		KASSERT(dq->dq_cnt > 0);
 		dqref(dq);
 		mutex_exit(&dqlock);
-		mutex_destroy(&dq->dq_interlock);
+		mutex_destroy(&ndq->dq_interlock);
 		pool_cache_put(dquot_cache, ndq);
 		*dqp = dq;
 		return 0;



CVS commit: [netbsd-5] src/sys/ufs/ufs

2009-08-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Aug  7 05:59:17 UTC 2009

Modified Files:
src/sys/ufs/ufs [netbsd-5]: ufs_quota.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #898):
sys/ufs/ufs/ufs_quota.c: revision 1.63
Add missing mutex_destroy() before pool_cache_put(). Prevents a
"Mutex error: lockdebug_alloc: already initialized" panic.


To generate a diff of this commit:
cvs rdiff -u -r1.60.10.1 -r1.60.10.2 src/sys/ufs/ufs/ufs_quota.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/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.60.10.1 src/sys/ufs/ufs/ufs_quota.c:1.60.10.2
--- src/sys/ufs/ufs/ufs_quota.c:1.60.10.1	Mon Feb  2 18:24:17 2009
+++ src/sys/ufs/ufs/ufs_quota.c	Fri Aug  7 05:59:17 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.60.10.1 2009/02/02 18:24:17 snj Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.60.10.2 2009/08/07 05:59:17 snj Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.60.10.1 2009/02/02 18:24:17 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.60.10.2 2009/08/07 05:59:17 snj Exp $");
 
 #include 
 #include 
@@ -887,6 +887,7 @@
 		KASSERT(dq->dq_cnt > 0);
 		dqref(dq);
 		mutex_exit(&dqlock);
+		mutex_destroy(&dq->dq_interlock);
 		pool_cache_put(dquot_cache, ndq);
 		*dqp = dq;
 		return 0;