Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Sep 1998 15:41:19 -0400 (EDT)
From:      Luoqi Chen <luoqi@watermarkgroup.com>
To:        current@FreeBSD.ORG
Subject:   Yet another patch to try for softupdates panic
Message-ID:  <199809181941.PAA29792@lor.watermarkgroup.com>

next in thread | raw e-mail | index | archive | help
This patch could be the real cure for the `initiate_write_filepage' panic
people were seeing during make -j# world. I have posted another patch
about a week ago (in fact, I have committed it), but it turned out to be
no more than a no-op (thanks to Bruce for pointing it out, it was an
embarrassing silly mistake of mine). I certainly hope this patch will do
its work: this patch should fix a race condition between directory truncation
and file creation that could lead to the `initiate_write_filepage' panic.

-lq

PS. I know it is bad coding style. I'll make it look better if it's
    proven to work.

Index: ffs_inode.c
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_inode.c,v
retrieving revision 1.47
diff -u -r1.47 ffs_inode.c
--- ffs_inode.c	1998/09/15 14:45:28	1.47
+++ ffs_inode.c	1998/09/18 12:41:16
@@ -191,7 +191,7 @@
 			 * rarely, we solve the problem by syncing the file
 			 * so that it will have no data structures left.
 			 */
-			if ((error = VOP_FSYNC(ovp, cred, MNT_WAIT,
+			if ((error = VOP_FSYNC(ovp, cred, MNT_WAIT|0x80000000,
 			    p)) != 0)
 				return (error);
 		} else {
Index: ffs_vnops.c
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_vnops.c,v
retrieving revision 1.51
diff -u -r1.51 ffs_vnops.c
--- ffs_vnops.c	1998/09/07 11:50:19	1.51
+++ ffs_vnops.c	1998/09/18 16:13:01
@@ -126,8 +126,8 @@
 	struct buf *nbp;
 	int s, error, passes, skipmeta;
 	daddr_t lbn;
+	int istrunc = 0;
 
-
 	if (vp->v_type == VBLK) {
 		lbn = INT_MAX;
 	} else {
@@ -137,6 +137,14 @@
 	}
 
 	/*
+	 * XXX hack to solve directory truncation problem
+	 */
+	if (ap->a_waitfor & 0x80000000) {
+		istrunc = 1;
+		ap->a_waitfor &= ~0x80000000;
+	}
+
+	/*
 	 * Flush all dirty buffers associated with a vnode.
 	 */
 	passes = NIADDR;
@@ -251,7 +259,7 @@
 	getmicrotime(&tv);
 	if ((error = UFS_UPDATE(vp, &tv, &tv, ap->a_waitfor == MNT_WAIT)) != 0)
 		return (error);
-	if (DOINGSOFTDEP(vp) && ap->a_waitfor == MNT_WAIT)
+	if (DOINGSOFTDEP(vp) && ap->a_waitfor == MNT_WAIT && !istrunc)
 		error = softdep_fsync(vp);
 	return (error);
 }

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



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