Re: [PATCH 1/3] Initial bcachefs support

Eryu Guan
2021-05-24T03:56:07Z

On Sun, May 23, 2021 at 06:51:49PM -0400, Kent Overstreet wrote:
[snip]

> > > ;;
> > > @@ -1179,6 +1197,19 @@ _repair_scratch_fs()
> > > fi
> > > return $res
> > > ;;
> > > + bcachefs)
> > > + fsck -t $FSTYP -n $SCRATCH_DEV 2>&1
> >
> > _repair_scratch_fs() is supposed to actually fix the errors, does
> > "fsck -n" fix errors for bcachefs?
>
> No - but with bcachefs fsck finding errors _always_ indicates a bug, so for the
> purposes of these tests I think this is the right thing to do - I don't want the
> tests to pass if fsck is finding and fixing errors.

Then _check_scratch_fs() should be used instead, which will fail the
test if any fsck finds any corruptions. _repair_scratch_fs() is meant to
fix errors, and only report failure when there's unfixable errors.

Thanks,
Eryu

>
> > > diff --git a/tests/generic/042 b/tests/generic/042
> > > index 35727bcbc6..42919e2313 100755
> > > --- a/tests/generic/042
> > > +++ b/tests/generic/042
> > > @@ -63,7 +63,8 @@ _crashtest()
> > >
> > > # We should /never/ see 0xCD in the file, because we wrote that pattern
> > > # to the filesystem image to expose stale data.
> > > - if hexdump -v -e '/1 "%02X "' $file | grep -q "CD"; then
> > > + # The file is not required to exist since we didn't sync before going down:
> > > + if [[ -f $file ]] && hexdump -v -e '/1 "%02X "' $file | grep -q "CD"; then
> > > echo "Saw stale data!!!"
> > > hexdump $file
> > > fi
> >
> > Updates for individual test should be in a separate patch.
>
> Ok, I'll split those out.