Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Apr 2014 07:54:17 +0000 (UTC)
From:      Scott Long <scottl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r264491 - stable/10/sys/ufs/ffs
Message-ID:  <201404150754.s3F7sHtb006907@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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");
 		/*



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