Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ffs When invalidating short buffers on the snapshots...



details:   https://anonhg.NetBSD.org/src/rev/0feab068d0a7
branches:  trunk
changeset: 786681:0feab068d0a7
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue May 07 09:40:54 2013 +0000

description:
When invalidating short buffers on the snapshots clean list use bbusy()
to mark the buffer busy.  There exists a small window where a buffer is
done but not released and therefore still busy.

diffstat:

 sys/ufs/ffs/ffs_snapshot.c |  18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r ed922429acad -r 0feab068d0a7 sys/ufs/ffs/ffs_snapshot.c
--- a/sys/ufs/ffs/ffs_snapshot.c        Tue May 07 07:01:37 2013 +0000
+++ b/sys/ufs/ffs/ffs_snapshot.c        Tue May 07 09:40:54 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_snapshot.c,v 1.121 2013/01/22 09:39:16 dholland Exp $      */
+/*     $NetBSD: ffs_snapshot.c,v 1.122 2013/05/07 09:40:54 hannken Exp $       */
 
 /*
  * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.121 2013/01/22 09:39:16 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.122 2013/05/07 09:40:54 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -345,11 +345,17 @@
        KASSERT(LIST_FIRST(&vp->v_dirtyblkhd) == NULL);
        for (bp = LIST_FIRST(&vp->v_cleanblkhd); bp; bp = nbp) {
                nbp = LIST_NEXT(bp, b_vnbufs);
-               KASSERT((bp->b_cflags & BC_BUSY) == 0);
-               if (bp->b_bcount < fs->fs_bsize) {
-                       bp->b_cflags |= BC_BUSY;
-                       brelsel(bp, BC_INVAL | BC_VFLUSH);
+               if (bp->b_bcount == fs->fs_bsize)
+                       continue;
+               error = bbusy(bp, false, 0, NULL);
+               if (error != 0) {
+                       if (error == EPASSTHROUGH) {
+                               nbp = LIST_FIRST(&vp->v_cleanblkhd);
+                               continue;
+                       }
+                       break;
                }
+               brelsel(bp, BC_INVAL | BC_VFLUSH);
        }
        mutex_exit(&bufcache_lock);
 



Home | Main Index | Thread Index | Old Index