Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs Fix an inconsistency where the last block of the...



details:   https://anonhg.NetBSD.org/src/rev/ebf6f0732669
branches:  trunk
changeset: 580452:ebf6f0732669
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sun Apr 24 15:49:37 2005 +0000

description:
Fix an inconsistency where the last block of the snapshot contains old data.

The last block of the file system is written to the snapshot before the
file system is suspended.  If the last cylinder group is modified after
the file system is suspended the last block of the snapshot may contain
old data.  So update this block again.

diffstat:

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

diffs (29 lines):

diff -r 287e8085706c -r ebf6f0732669 sys/ufs/ffs/ffs_snapshot.c
--- a/sys/ufs/ffs/ffs_snapshot.c        Sun Apr 24 13:34:18 2005 +0000
+++ b/sys/ufs/ffs/ffs_snapshot.c        Sun Apr 24 15:49:37 2005 +0000
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.12 2005/04/21 14:02:02 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.13 2005/04/24 15:49:37 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -292,6 +292,16 @@
        vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
        microtime(&starttime);
        /*
+        * If the last cylinder group has changed the last block
+        * saved before may have changed too so update it now.
+        */
+       if (!ACTIVECG_ISSET(fs, fs->fs_ncg-1)) {
+               if ((error = readfsblk(vp, cgbuf, numblks - 1)) != 0)
+                       goto out1;
+               if ((error = writevnblk(vp, cgbuf, numblks - 1)) != 0)
+                       goto out1;
+       }
+       /*
         * First, copy all the cylinder group maps that have changed.
         */
        for (cg = 0; cg < fs->fs_ncg; cg++) {



Home | Main Index | Thread Index | Old Index