Re: [PATCH v3 00/19] overlay: support idmapped layers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 31, 2022 at 03:05:33PM -0400, Vivek Goyal wrote:
> On Thu, Mar 31, 2022 at 01:22:58PM +0200, Christian Brauner wrote:
> 
> Hi Christian,
> 
> Following the example in here.
> 
> https://gitlab.com/brauner/fs.idmapped.overlay.xfstests.output/-/blob/main/manual.test.instructions
> 
> sudo mount-idmapped --map-mount b:10000000:0:100000000000 ./my-tmp /mnt
> 
> Initially I could not even create idmapped mounts. I had to specify
> full path and then it works. But relative path (./my-tmp) does not
> work.
> 
> For example this works.
> 
> /root/git/xfstests-dev/src/idmapped-mounts/mount-idmapped --map-mount b:10000000:0:100000000000 /root/idmapped-testing/my-tmp /root/idmapped-testing/shifted
> 
> But this fails.
> 
> $ /root/git/xfstests-dev/src/idmapped-mounts/mount-idmapped --map-mount b:10000000:0:100000000000 ./my-tmp shifted
> 
> Bad file descriptor - Failed to open ./my-tmp
> 
> Not sure if this is a limitation of idmapped-mounts or this is expected.

Heh, this is certainly not a limitation of idmapped mounts. :D
It is a limitation of the test binary.

Specifically, if you care it does:

	source = new_argv[0];
	target = new_argv[1];

	fd_tree = sys_open_tree(-EBADF, source,
			        OPEN_TREE_CLONE |
			        OPEN_TREE_CLOEXEC |
			        AT_EMPTY_PATH |
			        (recursive ? AT_RECURSIVE : 0));

if you specify ./my-tmp then you get:

open_tree(-9, "./my-dir", OPEN_TREE_CLONE|OPEN_TREE_CLOEXEC|AT_EMPTY_PATH) = -1 EBADF (Bad file descriptor)

which means ./my-dir is taken relative to -9 which lands you in

static const char *path_init(struct nameidata *nd, unsigned flags)
[...]
		struct fd f = fdget_raw(nd->dfd);
		struct dentry *dentry;

		if (!f.file)
			return ERR_PTR(-EBADF);
[...]

For this to work we'd need to detect a relative path and pass AT_FDCWD.

But that tool was really just intended for xfstests so I was lazy enough
to force people to specify full paths.



[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux