Re: How to fsck -CURRENT on next reboot [ext2fs]

From: Matthias Andree <ma_at_dt.e-technik.uni-dortmund.de>
Date: Thu, 22 Jan 2004 16:12:33 +0100
Bruce Evans <bde_at_zeta.org.au> writes:

>> 1. mount_ext2fs an ext2 or ext3 file system for read/write
>> 2. change a file (or touch or rm one)
>> 3. umount that ext2fs again
>>
>> 4. See how it complains about giving up on fsync first for the ext2fs, then
>>    for devfs.
>
> This hopefully only happens after mount -u to convert from ro to rw.

After checking that, indeed, that is the problem.

> It happens because GEOM has enforced the open mode on the disk device
> for a long time, but ext2fs is still missing the hack to always open
> rw in case mount -u is used to convert from ro to rw.  This gives lots
> of unwriteable buffers whose write is retried endlessly every second
> or 2 but never gets as far as the driver, and strange results for
> subsequent accesses to the file since the buffers are not invalid.

> %%%
> Index: ext2_vfsops.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/gnu/ext2fs/ext2_vfsops.c,v
> retrieving revision 1.114
> diff -u -2 -r1.114 ext2_vfsops.c
> --- ext2_vfsops.c	5 Nov 2003 11:56:58 -0000	1.114
> +++ ext2_vfsops.c	22 Jan 2004 10:39:38 -0000

*snip* that patch fixes the "cannot umount after upgrading from ro to
rw" problem (I also looked at the super block to find out if mount -r
would mark the file system unclean, but it does not, so it behaves
properly).

Thanks for the quick help!

As to the other questions you ask, it needs further testing (did you
mean to include a 2nd patch BTW?)

The remaining user-visible and most annoying problem is that a
ro-mounted ext2fs still produces "giving up on buffers" for my ufs file
systems at reboot/halt. I still need to manually umount ext2 file
systems before shutting down.

Oh, and while testing I found that "truss -f fsck /linux" caused to fsck
processes to lock up. One in D state, one in DV state (suspended in
vfork).

>> e2fsprogs (with mke2fs, the ext2fs newfs tool) are available as port
>> from http://mandree.home.pages.de/freebsd/e2fsprogs/ while Tytso
>> (e2fsprogs maintainer) reviews my changes - feedback on my port is
>> appreciated. The e2fsprogs stuff from official ports doesn't work
>> because it assumes that block devices are buffered.
>
> About time this was fixed :-).

Yep. BTW, I've updated the port to omit e2fsprogs' "fsck" command, to
avoid confusion. Unfortunately, I haven't yet seen feedback from
Tytso. He's downloaded my changes according to BK logs, but no new
release or merge yet. :-( I'm hesitant to release a "somewhat rogue"
snapshot from the development sources as official port.

I am wondering how to deal with /etc/fstab. I can of course add a
symlink from /sbin/fsck_ext2fs to %D/sbin/e2fsck, so I can type "fsck
/linux" and have the file system checked, but this will not work when
someone sets the Pass# column in fsck to something non-zero.

-- 
Matthias Andree

Encrypt your mail: my GnuPG key ID is 0x052E7D95
Received on Thu Jan 22 2004 - 06:12:44 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:39 UTC