Author: kib
Date: Thu Aug 12 08:35:24 2010
New Revision: 211212
URL: http://svn.freebsd.org/changeset/base/211212

Log:
  Softdep_process_worklist() should unsuspend not only before processing
  the worklist (in softdep_process_journal), but also after flushing the
  workitems. Might be, we should even do this before bwillwrite() too, but
  this seems to be not needed for now.
  
  Fs might be suspended during processing the queue, and then there is
  nobody around to unsuspend.
  
  In collaboration with:        pho
  Tested by:    bz
  Reviewed by:  jeff

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

Modified: head/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- head/sys/ufs/ffs/ffs_softdep.c      Thu Aug 12 06:20:54 2010        
(r211211)
+++ head/sys/ufs/ffs/ffs_softdep.c      Thu Aug 12 08:35:24 2010        
(r211212)
@@ -857,6 +857,7 @@ static      int journal_mount(struct mount *,
 static void journal_unmount(struct mount *);
 static int journal_space(struct ufsmount *, int);
 static void journal_suspend(struct ufsmount *);
+static int journal_unsuspend(struct ufsmount *ump);
 static void softdep_prelink(struct vnode *, struct vnode *);
 static void add_to_journal(struct worklist *);
 static void remove_from_journal(struct worklist *);
@@ -1390,6 +1391,8 @@ softdep_process_worklist(mp, full)
                if (!full && starttime != time_second)
                        break;
        }
+       if (full == 0)
+               journal_unsuspend(ump);
        FREE_LOCK(&lk);
        return (matchcnt);
 }
@@ -2436,6 +2439,27 @@ journal_suspend(ump)
        MNT_IUNLOCK(mp);
 }
 
+static int
+journal_unsuspend(struct ufsmount *ump)
+{
+       struct jblocks *jblocks;
+       struct mount *mp;
+
+       mp = UFSTOVFS(ump);
+       jblocks = ump->softdep_jblocks;
+
+       if (jblocks != NULL && jblocks->jb_suspended &&
+           journal_space(ump, jblocks->jb_min)) {
+               jblocks->jb_suspended = 0;
+               FREE_LOCK(&lk);
+               mp->mnt_susp_owner = curthread;
+               vfs_write_resume(mp);
+               ACQUIRE_LOCK(&lk);
+               return (1);
+       }
+       return (0);
+}
+
 /*
  * Called before any allocation function to be certain that there is
  * sufficient space in the journal prior to creating any new records.
@@ -2852,15 +2876,9 @@ softdep_process_journal(mp, flags)
         * space either try to sync it here to make some progress or
         * unsuspend it if we already have.
         */
-       if (flags == 0 && jblocks && jblocks->jb_suspended) {
-               if (journal_space(ump, jblocks->jb_min)) {
-                       FREE_LOCK(&lk);
-                       jblocks->jb_suspended = 0;
-                       mp->mnt_susp_owner = curthread;
-                       vfs_write_resume(mp);
-                       ACQUIRE_LOCK(&lk);
+       if (flags == 0 && jblocks->jb_suspended) {
+               if (journal_unsuspend(ump))
                        return;
-               }
                FREE_LOCK(&lk);
                VFS_SYNC(mp, MNT_NOWAIT);
                ffs_sbupdate(ump, MNT_WAIT, 0);
_______________________________________________
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