Re: Reducing UFS corruption from unclean shutdowns?

From: Don Lewis <truckman_at_FreeBSD.org>
Date: Fri, 21 Jun 2019 17:17:58 -0700 (PDT)
On 21 Jun, Scott Long wrote:
> 
> 
>> On Jun 21, 2019, at 4:37 PM, Warner Losh <imp_at_bsdimp.com> wrote:
>> 
>> On Fri, Jun 21, 2019, 3:33 PM Conrad Meyer <cem_at_freebsd.org> wrote:
>> 
>>> On Fri, Jun 21, 2019 at 2:55 PM Alan Somers <asomers_at_freebsd.org> wrote:
>>>> I would've thought that immediately following a sync(8), the
>>>> filesystem would be consistent.  Why do I still see errors after a
>>>> panic in files that were written before I sync()ed?
>>>> -Alan
>>> 
>>> Hi Alan,
>>> 
>>> Contra the name, sync(2) (sync(8)) isn't synchronous.  It invokes
>>> VFS_SYNC() with MNT_NOWAIT across all mountpoints.
>>> 
>> 
>> Yes. Sync(2) just starts the I/O, but it may be delayed if there is a lot
>> of dirty buffers. The other issue is that new buffers may be dirtied…
>> 
> 
> Still, the point of SU and SU+J is that the filesystem should not be
> damaged and require active repair on reboot, whether or not a
> sync or fsync was done.  There’s certainly issues with disk lying
> about out of order writes, POSIX sematics of unlinked files, and the
> inherent design of UFS superblock updates, but the problems that
> Alan reported should still be looked at, they’re not expected and
> they undermine the usefulness of SU+J.

Other that the inode hash error, the other issues should not prevent
safely mounting the filesystem read-write.  SU without J is able to fix
these problems with a background fsck while the filesystem is mounted
and in use.

SU+J should be able to fix all of these except for the inode hash error
by replaying the journal, but that is done by fsck.  At least it can
avoid the need to scan the entire filesystem.

The problem of the disk lying about write completions should only be a
problem if the power fails, or if we do something during the panic and
recovery that tells the disk to toss its write cache.

The main problem here is the inode hash error.  That shouldn't be
happening.
Received on Fri Jun 21 2019 - 22:18:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:21 UTC