Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Apr 1995 22:30:01 -0700
From:      nox@jelal.hb.north.de
To:        freebsd-bugs
Subject:   kern/371: panic: msdosfs_unlock: denode not locked
Message-ID:  <199504300530.WAA09381@freefall.cdrom.com>
In-Reply-To: Your message of Sun, 30 Apr 1995 02:16:36 %2B0200 (CEDT) <9504300016.AA00055@jelal.hb.north.de>

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

>Number:         371
>Category:       kern
>Synopsis:       panic: msdosfs_unlock: denode not locked
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 29 22:30:01 1995
>Originator:     Juergen Lock
>Organization:
me? organized?
>Release:        FreeBSD 2.0-RELEASE i386
>Environment:

	2.0R msdosfs with some fixes from the 'net,
	a messdos filesystem /dev/sd0h mounted on /dos...

>Description:

	When called from chflags looks like msdosfs_setattr clears
	its DE_LOCKED bit when it shouldn't.

>How-To-Repeat:

	(dunno if this works always...)
	load bindist in /usr/tmp/2.0-RELEASE, then:

	mkdir /dos/20r
	mv /usr/tmp/2.0-RELEASE/bindist /dos/20r

>Fix:
	
	Here is what i'm running now, relative to 2.0R.  the first one
is probably useless (left it there just in case), the second and third
ones are the fix, and the rest is from the net.  Of course i don't
know if this is TRT but it works for me...

--- msdosfs_vnops.c.orig	Tue Nov  1 22:14:45 1994
+++ msdosfs_vnops.c	Sun Apr 23 22:40:35 1995
@@ -382,7 +382,8 @@
 	}
 
 	if (vap->va_size != VNOVAL) {
-		if (ap->a_vp->v_type == VDIR)
+		if (ap->a_vp->v_type == VDIR ||
+		    (dep->de_Attributes & ATTR_DIRECTORY))
 			return EISDIR;
 		error = detrunc(dep, vap->va_size, 0, cred, ap->a_p);
 		if (error)
@@ -410,6 +411,9 @@
 	}
 
 	if (vap->va_flags != VNOVAL) {
+		/* always true? */
+		u_long locked = dep->de_flag & DE_LOCKED;
+
 		error = suser(cred, &ap->a_p->p_acflag);
 		if (error)
 			return error;
@@ -420,6 +424,9 @@
 			dep->de_flag |= (vap->va_flags & 0xffff);
 		}
 		dep->de_flag |= DE_UPDATE;
+		if (locked)
+			/* !!! */
+			dep->de_flag |= DE_LOCKED;
 	}
 	return error;
 }
@@ -881,7 +888,9 @@
 		struct componentname *a_cnp;
 	} */ *ap;
 {
-	return VOP_ABORTOP(ap->a_vp, ap->a_cnp);
+	VOP_ABORTOP(ap->a_vp, ap->a_cnp);
+	vput(ap->a_vp);
+	return EMLINK;
 }
 
 /*
@@ -972,7 +981,7 @@
 	tdep = tvp ? VTODE(tvp) : NULL;
 	pmp = fddep->de_pmp;
 
-#ifdef __NetBSD__
+#if 1 /*def __NetBSD__*/
 	/* Check for cross-device rename */
 	if ((ap->a_fvp->v_mount != ap->a_tdvp->v_mount) ||
 	    (tvp && (ap->a_fvp->v_mount != tvp->v_mount))) {
--- msdosfs_denode.c.orig	Mon Oct 10 08:57:32 1994
+++ msdosfs_denode.c	Tue Apr 11 12:40:40 1995
@@ -119,13 +119,6 @@
 	dep->de_next = deq;
 	dep->de_prev = depp;
 	*depp = dep;
-	if (dep->de_flag & DE_LOCKED)
-		panic("msdosfs_hashins: already locked");
-	if (curproc)
-		dep->de_lockholder = curproc->p_pid;
-	else
-		dep->de_lockholder = -1;
-	dep->de_flag |= DE_LOCKED;
 }
 
 static void
@@ -236,6 +229,7 @@
 	 * can't be accessed until we've read it in and have done what we
 	 * need to it.
 	 */
+	VOP_LOCK(nvp);
 	msdosfs_hashins(ldep);
 
 	/*
>Audit-Trail:
>Unformatted:





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