Re: fsconfig04: Check FSCONFIG_SET_PATH

Andrea Cervesato via ltp <[email protected]>
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
Hi Wei,

> > > +	TEST(fsconfig(fd, FSCONFIG_SET_PATH, "journal_path", dev2, 0));
> > > +	if (TST_RET == -1) {
> > > +		if (TST_ERR == EOPNOTSUPP)
> > > +			tst_brk(TCONF, "fsconfig(FSCONFIG_SET_PATH) not supported");
> > > +		else
> > > +			tst_brk(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_PATH) failed");
> > > +	}
> > 
> > Could this test be gated with .min_kver = "7.2"?
> > 
> > Before Linux 7.2, ext4 declared journal_path as a string parameter, so
> > FSCONFIG_SET_PATH is rejected with EINVAL rather than EOPNOTSUPP. Since
> > fsopen_supported_by_kernel() only gates fsopen at Linux 5.2, those kernels
> > reach the else branch and report TFAIL instead of TCONF.
> If fsconfig parameter is correct, return EINVAL should be an kernel bug.
> Current logic is correct.
> I guess AI mix wtih some old code with new API. But how to fix AI's rule is a
> question.

yeah, agent is wrong.

> > 
> > > +	SAFE_SSCANF(dev2, "/dev/%s", loop_name);
> > > +
> > > +	snprintf(path, sizeof(path), "/sys/block/%s/dev", loop_name);
> > > +	SAFE_FILE_SCANF(path, "%u:%u", &major, &minor);
> > 
> > Could the device number be obtained from stat(dev2).st_rdev instead?

what about this?

> > 
> > tst_find_free_loopdev() also supports /dev/loop/N and /dev/block/loopN.
> > Those paths produce loop/N or block/loopN here, causing the test to read a
> > nonexistent sysfs path and terminate with TBROK.
> > 
> > > +	SAFE_MKFS(dev0, tst_device->fs_type, mkfs_opts_set_journal_dev1, NULL);
> > > +}
> > > +
> > > +static void run(void)
> > > +{
> > > +	...
> > > +	TEST(fsconfig(fd, FSCONFIG_SET_PATH, "journal_path", dev2, 0));
> > 
> > Could each iteration reset dev0 to dev1 or alternate the source and target
> > journal devices?
> > 
> > The first iteration persists dev2 in dev0's superblock. Every subsequent
> > -i iteration requests dev2 again, so it no longer exercises a dynamic
> > journal-device change.

and this?

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato-IBi9RG/[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.