tech-kern archive

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

clearing bogus journal



Hi,
I have some old filesystems (from the NetBSD 1.x date) that refuses to
mount -o log, or even r/w, after fsck_ffs -c4:
# mount -o log /usr
ffs_wapbl: unknown journal type 255
mount_ffs: /dev/raid1e on /usr: incorrect super block
# mount /dev/raid1e /usr
ffs_wapbl: unknown journal type 255
mount_ffs: /dev/raid1e on /usr: incorrect super block

(note I could also reproduce this with fsck_ffs -c3 followed by fsck_ffs -c4).
tunefs says:
# tunefs -N /usr
tunefs: tuning /dev/rraid1e
tunefs: current settings of /dev/rraid1e
        maximum contiguous block count 8
        maximum blocks per file in a cylinder group 2048
        minimum percentage of free space 5%
        optimization preference: time
        average file size: 16384
        expected number of files per directory: 64
        journal log file location: unknown
        journal log file size: 0

        journal log flags: clear-log clear-log
(the first "clear-log" should be "create-log", I just commited the fix).
I tried disabling the log, but:
# tunefs -l0 /usr     
tunefs: tuning /dev/rraid1e
tunefs: Can't change size of non-in-filesystem log

I think tunefs should be able to clear any kind of log (it looks like the
kenrel can already do it), and the kernel should be able to clear the
log even if fs->fs_journal_location is bogus. The attached patch does
so. With these changes, I could clear the bogus log entry on first mount,
and let mount -o log create a proper in-filesystem log on second mount.
Any comment on this one ?

A second question is whenever fsck_ffs should do minimum checks against
the log integrity, and ask for help if it finds a problem. My guess is that
it should propose to clear the log flag(s) and do a "normal" ffs check in
such a case. Any idea on what proper behavior of fsck_ffs would be
with log ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: sbin/tunefs/tunefs.c
===================================================================
RCS file: /cvsroot/src/sbin/tunefs/tunefs.c,v
retrieving revision 1.37
diff -u -r1.37 tunefs.c
--- sbin/tunefs/tunefs.c        31 Jul 2008 15:55:41 -0000      1.37
+++ sbin/tunefs/tunefs.c        17 Aug 2009 21:48:49 -0000
@@ -389,7 +389,7 @@
                break;
        }
 
-       if (!in_fs_log)
+       if (!in_fs_log && logfilesize > 0)
                errx(1, "Can't change size of non-in-filesystem log");
 
        if (old_size == logfilesize && logfilesize > 0) {
Index: sys/ufs/ffs/ffs_wapbl.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_wapbl.c,v
retrieving revision 1.6
diff -u -r1.6 ffs_wapbl.c
--- sys/ufs/ffs/ffs_wapbl.c     8 Sep 2008 03:16:43 -0000       1.6
+++ sys/ufs/ffs/ffs_wapbl.c     17 Aug 2009 21:48:49 -0000
@@ -286,7 +286,7 @@
        default:
                printf("ffs_wapbl: unknown journal type %d\n",
                    fs->fs_journal_location);
-               return EINVAL;
+               break;
        }
 
 


Home | Main Index | Thread Index | Old Index