[LTP] [PATCH V5 04/10] syscalls/fsopen: New tests
Viresh Kumar
viresh.kumar@linaro.org
Thu Mar 12 11:03:16 CET 2020
On 12-03-20, 09:11, Petr Vorel wrote:
> 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().
But why won't move_mount() fail if device isn't mounted ? Why do we
need the tst_is_mounted() helper at all ? Just to catch a case where
move_mount() is buggy and doesn't report the failure properly, right ?
In case of that bug, isn't it possible that move_mount() allocates
some resources which must be freed with a call to umount()
nevertheless ?
--
viresh
More information about the ltp
mailing list