[LTP] [PATCH V5 04/10] syscalls/fsopen: New tests

Petr Vorel pvorel@suse.cz
Thu Mar 12 09:11:53 CET 2020


Hi Viresh,

> > > +	TEST(move_mount(fsmfd, "", AT_FDCWD, MNTPOINT,
> > > +			MOVE_MOUNT_F_EMPTY_PATH));
> > > +
> > > +	SAFE_CLOSE(fsmfd);
> > > +
> > > +	if (TST_RET == -1) {
> > > +		tst_res(TFAIL | TERRNO, "move_mount() failed");
> > > +		goto out;
> > > +	}
> > > +
> > > +	if (tst_is_mounted(MNTPOINT))
> > > +		tst_res(TPASS, "%s: fsopen() passed", tc->name);
> > > +
> > > +	SAFE_UMOUNT(MNTPOINT);

> > I gues sthat the SAFE_UMOUNT() should be inside of the if here and in
> > the rest of the testcases.

> Petr had a similar comment earlier and here is my explanation to it.

> There should always be a unmount() in response to a successful call to
> mount() APIs. What if, because of some other bugs in the kernel or
> testsuite, tst_is_mounted() returns 0? We should still do the
> unmount() part as the mount() API didn't return an error.
But IMHO if device is not mounted we get TBROK due EINVAL in safe_umount().
I'd understand if this was in cleanup function where TBROK turns to TWARN.

Kind regards,
Petr


More information about the ltp mailing list