svn commit: r264491 - stable/10/sys/ufs/ffs

Scott Long scottl at FreeBSD.org
Tue Apr 15 07:54:17 UTC 2014


Author: scottl
Date: Tue Apr 15 07:54:17 2014
New Revision: 264491
URL: http://svnweb.freebsd.org/changeset/base/264491

Log:
  MFC r262814
  
  - 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.
  
  Submitted by:	jeffr

Modified:
  stable/10/sys/ufs/ffs/ffs_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ufs/ffs/ffs_vnops.c
==============================================================================
--- stable/10/sys/ufs/ffs/ffs_vnops.c	Tue Apr 15 07:50:18 2014	(r264490)
+++ stable/10/sys/ufs/ffs/ffs_vnops.c	Tue Apr 15 07:54:17 2014	(r264491)
@@ -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");
 		/*


More information about the svn-src-all mailing list