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

Viresh Kumar
2020-03-11T07:25:02Z

On 06-03-20, 14:10, Cyril Hrubis wrote:
> Hi!
> > + 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.

--
viresh