Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Mar 2014 00:13:21 +0000 (UTC)
From:      Jeff Roberson <jeff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r262814 - head/sys/ufs/ffs
Message-ID:  <201403060013.s260DLGI081577@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jeff
Date: Thu Mar  6 00:13:21 2014
New Revision: 262814
URL: http://svnweb.freebsd.org/changeset/base/262814

Log:
   - If we fail to do a non-blocking acquire of a buf lock while doing a
     waiting sync pass we need to do a blocking acquire and restart.
     Another thread, typically the buf daemon, may have this buf locked and
     if we don't wait we can fail to sync the file.  This lead to a great
     variety of softdep panics because we rely on all dependencies being
     flushed before proceeding in several cases.
  
  Reported by:	pho
  Discussed with:	mckusick
  Sponsored by:	EMC / Isilon Storage Division
  MFC after:	2 weeks

Modified:
  head/sys/ufs/ffs/ffs_vnops.c

Modified: head/sys/ufs/ffs/ffs_vnops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vnops.c	Thu Mar  6 00:11:47 2014	(r262813)
+++ head/sys/ufs/ffs/ffs_vnops.c	Thu Mar  6 00:13:21 2014	(r262814)
@@ -259,9 +259,17 @@ loop:
 			continue;
 		if (bp->b_lblkno > lbn)
 			panic("ffs_syncvnode: syncing truncated data.");
-		if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL))
+		if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL) == 0) {
+			BO_UNLOCK(bo);
+		} else if (wait != 0) {
+			if (BUF_LOCK(bp,
+			    LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK,
+			    BO_LOCKPTR(bo)) != 0) {
+				bp->b_vflags &= ~BV_SCANNED;
+				goto next;
+			}
+		} else
 			continue;
-		BO_UNLOCK(bo);
 		if ((bp->b_flags & B_DELWRI) == 0)
 			panic("ffs_fsync: not dirty");
 		/*



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