[LTP] [PATCH v3] safe_mount: safe_umount: print debug info about the operation

Li Wang liwang@redhat.com
Fri Jun 16 11:23:03 CEST 2023


On Fri, Jun 16, 2023 at 4:38 PM Martin Doucha <mdoucha@suse.cz> wrote:

> On 16. 06. 23 4:50, Li Wang wrote:
> > On Thu, Jun 15, 2023 at 9:24 AM Murphy Zhou <jencce.kernel@gmail.com>
> wrote:
> >
> >> Make the source and the target to mount/umount visible. It's
> >> good for debugging.
> >>
> >> Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
> >> ---
> >> v3:
> >>    Apply suggestions from Li and Martin. Thanks very much!
> >>
> >>   lib/safe_macros.c | 17 +++++++++++++++++
> >>   1 file changed, 17 insertions(+)
> >>
> >> diff --git a/lib/safe_macros.c b/lib/safe_macros.c
> >> index af6dd0716..26f9136af 100644
> >> --- a/lib/safe_macros.c
> >> +++ b/lib/safe_macros.c
> >> @@ -898,7 +898,16 @@ int safe_mount(const char *file, const int lineno,
> >> void (*cleanup_fn)(void),
> >>                 const void *data)
> >>   {
> >>          int rval = -1;
> >> +       char mpath[PATH_MAX];
> >>
> >> +       if (realpath(target, mpath)) {
> >> +               tst_resm_(file, lineno, TINFO,
> >> +                       "Mounting %s to %s fstyp=%s flags=%lx",
> >> +                       source, mpath, filesystemtype, mountflags);
> >> +       } else {
> >> +               tst_resm_(file, lineno, TBROK | TERRNO, cleanup_fn,
> >>
> >
> > Forget to mention that, this should be tst_brkm_(.., TBROK | TERRNO,
> ...),
> > I manually fix it and pushed.
>
> I thought my review of the v2 patch was clear enough that both branches
> of this condition should call tst_resm_(... TINFO ...). There is no
> reason to fail the test here.
>

Ah, sorry for overlooking that. I saw here that used tst_resm_( ...TBRK ...)
which is not the correct usage. So I guess he might want tst_brkm_(),
but anyway you are right. Let's fix it in a separate patch.


-- 
Regards,
Li Wang


More information about the ltp mailing list