All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Gao via ltp <ltp@lists.linux.it>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] mount_setattr02.c: Check mount_setattr attr.propagation
Date: Wed, 19 Feb 2025 03:47:10 -0500	[thread overview]
Message-ID: <Z7WajlVc0xMSztSe@wegao> (raw)
In-Reply-To: <20250218151858.GA2492575@pevik>

On Tue, Feb 18, 2025 at 04:18:58PM +0100, Petr Vorel wrote:
> Hi Wei,
> 
> nit: I guess you want to replace dot with space in subject.
You mean i s/attr.propagation/attr propagation ?
> 
> > +++ b/testcases/kernel/syscalls/mount_setattr/mount_setattr02.c
> > @@ -0,0 +1,102 @@
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + * Copyright (C) 2025 SUSE LLC Wei Gao <wegao@suse.com>
> > + */
> > +
> > +/*\
> > + * [Description]
> > + *
> > + * Basic mount_setattr() test.
> > + * Test basic propagation mount attributes are set correctly.
> > + */
> > +
> > +#define _GNU_SOURCE
> > +
> > +#include <sys/statvfs.h>
> > +#include "tst_test.h"
> > +#include "lapi/fsmount.h"
> > +#include "tst_safe_stdio.h"
> > +
> > +#define DIRA "/DIRA_PROPAGATION_CHECK"
> 
> Is it necessary to to use directory under root?
Yes. Otherwise failed will happen during mount_setattr.
But i have not check for detail.
> 
> ...
> > +static void cleanup(void)
> > +{
> 
> I guess this is due result of:
> SAFE_MOUNT(NULL, "/", NULL, MS_REC | MS_PRIVATE, 0);
> There should be either a proper detection whether this works or 
> 
> ../../../../include/lapi/fsmount.h:113: TCONF: syscall(442) __NR_mount_setattr not supported on your arch
> mount_setattr02.c:52: TWARN: rmdir(/DIRA_PROPAGATION_CHECK) failed: EBUSY (16)
> 
> 
> > +	SAFE_RMDIR(DIRA);
> 
> When running on old kernel (e.g. SLES based 4.12) it fails due TCONF:
> 
> ../../../../include/lapi/fsmount.h:197: TCONF: Test not supported on kernel version < v5.2
> mount_setattr02.c:52: TWARN: rmdir(/DIRA_PROPAGATION_CHECK) failed: ENOENT (2)
> 
> There should be a flag to remove dir only when it was created.
> 
> > +
> nit: please remove this new line (I have to keep asking this :( ).
Sorry, i need pay attention, thanks for point this out with great patient :).
> > +}
> > +
> > +static void setup(void)
> > +{
> > +	fsopen_supported_by_kernel();
> I wonder if this needed for detecting new mount API support. Because second
> SAFE_MOUNT also runs code which detects code unsupported:
> 
> ../../../../include/lapi/fsmount.h:113: TCONF: syscall(442) __NR_mount_setattr not supported on your arch
> mount_setattr02.c:52: TWARN: rmdir(/DIRA_PROPAGATION_CHECK) failed: EBUSY (16)
> 
> But I have no idea what would be needed to be done to cleanup result of the
> first SAFE_MOUNT().
> 
> > +
> > +	SAFE_MKDIR(DIRA, 0777);
> > +}
> > +
> > +static void run(void)
> > +{
> > +
> and here new line.
> > +	SAFE_UNSHARE(CLONE_NEWNS);
> > +	SAFE_MOUNT(NULL, "/", NULL, MS_REC | MS_PRIVATE, 0);
> > +	SAFE_MOUNT("testing", DIRA, "tmpfs", MS_NOATIME | MS_NODEV, "");
> Do these 2 needs to be in the run()? How about move them to setup()?
> 
> static int dir_created, mounted;
> 
> static void setup(void)
> {
> 	fsopen_supported_by_kernel();
> 
> 	SAFE_MKDIR(DIRA, 0777);
> 	dir_created = 1;
> 	SAFE_UNSHARE(CLONE_NEWNS);
> 	SAFE_MOUNT(NULL, "/", NULL, MS_REC | MS_PRIVATE, 0);
> 	SAFE_MOUNT("testing", DIRA, "tmpfs", MS_NOATIME | MS_NODEV, "");
> 	mounted = 1;
> }
> 
> static void cleanup(void)
> {
> 	if (mounted)
> 		SAFE_UMOUNT(DIRA);
> 
> 	if (dir_created)
> 		SAFE_RMDIR(DIRA);
> }
> 
> + I later create generic helper from is_shared_mount().
I sent v2 patch now, once your create generic helper i can do another patch together with
your generic helper.
> 
> Kind regards,
> Petr
> 

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2025-02-19  8:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17  2:04 [LTP] [PATCH v1] mount_setattr02.c: Check mount_setattr attr.propagation Wei Gao via ltp
2025-02-18 15:18 ` Petr Vorel
2025-02-19  8:47   ` Wei Gao via ltp [this message]
2025-02-19  9:05     ` Petr Vorel
2025-02-19  9:51       ` Wei Gao via ltp
2025-02-19 11:24         ` Petr Vorel
2025-02-19  8:29 ` [LTP] [PATCH v2] " Wei Gao via ltp
2025-02-21 12:54   ` Petr Vorel
2025-02-24  1:44     ` Wei Gao via ltp
2025-03-19 11:41   ` [LTP] [PATCH v3] mount_setattr02.c: Check mount_setattr attr propagation Wei Gao via ltp
2025-07-11  9:21     ` Cyril Hrubis
2025-07-24 13:40     ` [LTP] [PATCH v4] " Wei Gao via ltp
2025-07-28 15:37       ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z7WajlVc0xMSztSe@wegao \
    --to=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    --cc=wegao@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.