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");
                /*
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to