Source-Changes-HG archive

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

[src/netbsd-1-6]: src/sys/ufs/ffs Pull up revision 1.99 (requested by chs in ...



details:   https://anonhg.NetBSD.org/src/rev/326cc0e74a69
branches:  netbsd-1-6
changeset: 527833:326cc0e74a69
user:      tv <tv%NetBSD.org@localhost>
date:      Mon Jun 10 16:46:17 2002 +0000

description:
Pull up revision 1.99 (requested by chs in ticket #227):
allow read-only mounts even if we can't read the last fragment of the fs.
this enables one to recover data from a failing disk (where the read failure
is a hardware problem) while avoiding corrupting the fs further (in the case
where the read failure is due to a misconfiguration).

diffstat:

 sys/ufs/ffs/ffs_vfsops.c |  27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diffs (50 lines):

diff -r e53070fcc32f -r 326cc0e74a69 sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Mon Jun 10 16:34:56 2002 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Mon Jun 10 16:46:17 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.98 2002/04/10 08:05:13 mycroft Exp $  */
+/*     $NetBSD: ffs_vfsops.c,v 1.98.4.1 2002/06/10 16:46:17 tv Exp $   */
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.98 2002/04/10 08:05:13 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.98.4.1 2002/06/10 16:46:17 tv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -715,18 +715,21 @@
        bp = NULL;
 
        /*
-        * verify that we can access the last block in the fs.
+        * verify that we can access the last block in the fs
+        * if we're mounting read/write.
         */
 
-       error = bread(devvp, fsbtodb(fs, fs->fs_size - 1), fs->fs_fsize, cred,
-           &bp);
-       if (bp->b_bcount != fs->fs_fsize)
-               error = EINVAL;
-       bp->b_flags |= B_INVAL;
-       if (error)
-               goto out;
-       brelse(bp);
-       bp = NULL;
+       if (!ronly) {
+               error = bread(devvp, fsbtodb(fs, fs->fs_size - 1), fs->fs_fsize,
+                   cred, &bp);
+               if (bp->b_bcount != fs->fs_fsize)
+                       error = EINVAL;
+               bp->b_flags |= B_INVAL;
+               if (error)
+                       goto out;
+               brelse(bp);
+               bp = NULL;
+       }
 
        fs->fs_ronly = ronly;
        if (ronly == 0) {



Home | Main Index | Thread Index | Old Index