Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs Don't abort when APPLE_UFS autodetection cannot ...



details:   https://anonhg.NetBSD.org/src/rev/55ce9457c847
branches:  trunk
changeset: 763595:55ce9457c847
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Mar 27 08:04:50 2011 +0000

description:
Don't abort when APPLE_UFS autodetection cannot read the apple ufs label
due to sector size or alignment problems. Autodetection is only a safety
measure, you should mark the filesystem type in the BSD disklabel.

diffstat:

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

diffs (46 lines):

diff -r cafe02520962 -r 55ce9457c847 sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Sun Mar 27 05:13:15 2011 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Sun Mar 27 08:04:50 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.264 2011/03/06 17:08:38 bouyer Exp $  */
+/*     $NetBSD: ffs_vfsops.c,v 1.265 2011/03/27 08:04:50 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.264 2011/03/06 17:08:38 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.265 2011/03/27 08:04:50 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -678,17 +678,22 @@
        else {
                /* Manually look for an apple ufs label, and if a valid one
                 * is found, then treat it like an Apple UFS filesystem anyway
+                *
+                * EINVAL is most probably a blocksize or alignment problem,
+                * it is unlikely that this is an Apple UFS filesystem then.
                 */
                error = bread(devvp, (daddr_t)(APPLEUFS_LABEL_OFFSET / DEV_BSIZE),
                        APPLEUFS_LABEL_SIZE, cred, 0, &bp);
-               if (error) {
+               if (error && error != EINVAL) {
                        brelse(bp, 0);
                        return (error);
                }
-               error = ffs_appleufs_validate(fs->fs_fsmnt,
-                       (struct appleufslabel *)bp->b_data, NULL);
-               if (error == 0)
-                       ump->um_flags |= UFS_ISAPPLEUFS;
+               if (error == 0) {
+                       error = ffs_appleufs_validate(fs->fs_fsmnt,
+                               (struct appleufslabel *)bp->b_data, NULL);
+                       if (error == 0)
+                               ump->um_flags |= UFS_ISAPPLEUFS;
+               }
                brelse(bp, 0);
                bp = NULL;
        }



Home | Main Index | Thread Index | Old Index