[LTP] [RFC] [PATCH 01/15] lib/tst_mkfs: Clear first 512k of the device

Cyril Hrubis
2017-09-07T08:34:28Z

Hi!
> > If we cal tst_mkfs() from a test more than once we end up with the very
> > same bug we already fixed by clearing the device in
> > tst_acquire_device(), i.e. some mkfs programs will not format it when
> > there is a valid FS signature there.
> >
> > So this commit moves the code to clear up the first 512k of the device
> > from tst_acquire_device() to the tst_mkfs() where it rightfully belongs.
>
> Didn't we move the clearing to tst_acquire_device() because of shell library
> some time ago? tst_mkfs() from tst_test.sh is not using tst_mkfs_().

Right, the shell mkfs test would fail in a case that we have a device
passed via LTP_DEV because the start of the device wouldn't be cleaned
at all.

I guess that the easiest solution would be leaving the code to clear the
start of the device in the acquire_device() as well. We would end up
clearing it twice in some situations though.

--
Cyril Hrubis
chrubis@suse.cz