From: Petr Vorel <pvorel@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>,
Andrea Cervesato <andrea.cervesato@suse.de>,
Sebastian Chlad <schlad@suse.de>,
ltp@lists.linux.it, Avinesh Kumar <akumar@suse.de>
Subject: Re: [LTP] [PATCH] Fix unlink09 test
Date: Wed, 5 Jun 2024 14:27:41 +0200 [thread overview]
Message-ID: <20240605122741.GB387399@pevik> (raw)
In-Reply-To: <20240605121142.GA387399@pevik>
Hi Martin,
> Hi Martin,
> > On 05. 06. 24 9:38, Petr Vorel wrote:
> > > BTW shouldn't this test use .all_filesystems = 1 ? Or is it unlink() really VFS
> > > only code? I see some specific functions in fs/*/, e.g. btrfs_unlink() or
> > > ext4_unlink(), which are used for struct inode_operations unlink member.
> > > Then, obviously also Andrea's check would be needed (otherwise is unlikely that
> > > somebody would have TMPDIR on vfat or exfat).
> > AFAICT, .all_filesystems and .needs_rofs are mutually exclusive at the
> > moment.
Also I wonder if having functionality for .all_filesystems + .needs_rofs
wouldn't be useful. @Cyril @Martin WDYT?
Also, there is fallback when prepare_and_mount_ro_fs() fails to use block
device. Although, I don't see the read only mount flags added in this fallback,
IMHO MS_RDONLY is only in prepare_and_mount_ro_fs(), therefore the fallback is
read write and we even didn't get TWARN, just plain TINFO (it should be either
TWARN or TINFO with "WARNING:" at least).
Kind regards,
Petr
lib/tst_test.c
static void prepare_device(void)
{
...
if (tst_test->needs_rofs) {
/* If we failed to mount read-only tmpfs. Fallback to
* using a device with read-only filesystem.
*/
if (prepare_and_mount_ro_fs(NULL, tst_test->mntpoint, "tmpfs")) {
tst_res(TINFO, "Can't mount tmpfs read-only, "
"falling back to block device...");
tst_test->needs_device = 1;
tst_test->format_device = 1;
}
}
static int prepare_and_mount_ro_fs(const char *dev, const char *mntpoint,
const char *fs_type)
{
char buf[PATH_MAX];
if (mount(dev, mntpoint, fs_type, 0, NULL)) {
tst_res(TINFO | TERRNO, "Can't mount %s at %s (%s)",
dev, mntpoint, fs_type);
return 1;
}
mntpoint_mounted = 1;
snprintf(buf, sizeof(buf), "%s/dir/", mntpoint);
SAFE_MKDIR(buf, 0777);
snprintf(buf, sizeof(buf), "%s/file", mntpoint);
SAFE_FILE_PRINTF(buf, "file content");
SAFE_CHMOD(buf, 0777);
SAFE_MOUNT(dev, mntpoint, fs_type, MS_REMOUNT | MS_RDONLY, NULL);
return 0;
}
> Good point, I completely overlook .needs_rofs. That makes things clearer.
> ATM we have 3 other tests in syscalls/unlink. Not sure if all are filesystem
> specific (I would say yes, but not sure), but at least unlink05.c (tests
> deleting with unlink()) should be tested .all_filesystems. unlink07.c and
> unlink08.c test errno.
> Kind regards,
> Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-06-05 12:28 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 13:44 [LTP] [PATCH] Fix unlink09 test Andrea Cervesato
2024-06-05 6:57 ` Petr Vorel
2024-06-05 7:38 ` Petr Vorel
2024-06-05 7:55 ` Andrea Cervesato via ltp
2024-06-05 8:04 ` Cyril Hrubis
2024-06-05 12:02 ` Martin Doucha
2024-06-05 12:11 ` Petr Vorel
2024-06-05 12:27 ` Petr Vorel [this message]
2024-06-05 12:34 ` Martin Doucha
2024-06-05 13:21 ` Petr Vorel
2024-06-05 13:44 ` Cyril Hrubis
2024-06-05 13:53 ` Martin Doucha
2024-06-05 14:17 ` Petr Vorel
2024-06-05 14:12 ` Petr Vorel
2024-06-05 14:24 ` Konstantin Ryabitsev
2024-06-07 9:36 ` Petr Vorel
2024-06-05 8:11 ` Cyril Hrubis
2024-06-05 10:16 ` Andrea Cervesato via ltp
2024-06-05 11:30 ` Cyril Hrubis
2024-06-05 11:42 ` Andrea Cervesato via ltp
2024-06-05 11:53 ` Martin Doucha
2024-06-05 12:05 ` Martin Doucha
2024-06-05 12:22 ` Martin Doucha
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=20240605122741.GB387399@pevik \
--to=pvorel@suse.cz \
--cc=akumar@suse.de \
--cc=andrea.cervesato@suse.de \
--cc=ltp@lists.linux.it \
--cc=mdoucha@suse.cz \
--cc=schlad@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox