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

Cyril Hrubis
2020-03-12T10:11:28Z

Hi!
> > > > 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 ?

We can't really clean things up when something in kernel is misbehaving.
If there is a bug we enter the wast lands of undefined behavior where
anything is possible and any attempt to restore the system in a defined
state is doomed to fail anyways.

So in the end I do not care here as long as we clean up properly when
things work as expected, so either way is fine. It only looks a bit
strange when we attempt to umount things that are possibly not mounted.

--
Cyril Hrubis
chrubis@suse.cz