Commit 2462651
committed
fs: allow changing idmappings
This patchset makes it possible to create a new idmapped mount from an
already idmapped mount and to clear idmappings.
// Create a first idmapped mount
struct mount_attr attr = {
.attr_set = MOUNT_ATTR_IDMAP
.userns_fd = fd_userns
};
fd_tree = open_tree(-EBADF, "/", OPEN_TREE_CLONE, &attr, sizeof(attr));
move_mount(fd_tree, "", -EBADF, "/mnt", MOVE_MOUNT_F_EMPTY_PATH);
// Create a second idmapped mount from the first idmapped mount
attr.attr_set = MOUNT_ATTR_IDMAP;
attr.userns_fd = fd_userns2;
fd_tree2 = open_tree(-EBADF, "/mnt", OPEN_TREE_CLONE, &attr, sizeof(attr));
// Create a second non-idmapped mount from the first idmapped mount:
memset(&attr, 0, sizeof(attr));
attr.attr_clr = MOUNT_ATTR_IDMAP;
fd_tree2 = open_tree(-EBADF, "/mnt", OPEN_TREE_CLONE, &attr, sizeof(attr));
Link: https://lore.kernel.org/r/20250128-work-mnt_idmap-update-v2-v1-5-c25feb0d2eb3@kernel.org
Reviewed-by: "Seth Forshee (DigitalOcean)" <sforshee@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>1 parent 325cca8 commit 2462651
1 file changed
+32
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
4612 | 4613 | | |
4613 | 4614 | | |
4614 | 4615 | | |
4615 | | - | |
4616 | | - | |
4617 | | - | |
| 4616 | + | |
| 4617 | + | |
4618 | 4618 | | |
4619 | | - | |
| 4619 | + | |
4620 | 4620 | | |
4621 | 4621 | | |
4622 | 4622 | | |
| |||
4706 | 4706 | | |
4707 | 4707 | | |
4708 | 4708 | | |
| 4709 | + | |
| 4710 | + | |
4709 | 4711 | | |
4710 | 4712 | | |
4711 | 4713 | | |
4712 | | - | |
4713 | | - | |
4714 | | - | |
4715 | | - | |
4716 | | - | |
4717 | | - | |
4718 | | - | |
4719 | | - | |
| 4714 | + | |
| 4715 | + | |
| 4716 | + | |
4720 | 4717 | | |
| 4718 | + | |
4721 | 4719 | | |
4722 | 4720 | | |
4723 | 4721 | | |
| |||
4826 | 4824 | | |
4827 | 4825 | | |
4828 | 4826 | | |
4829 | | - | |
4830 | | - | |
4831 | | - | |
4832 | | - | |
4833 | | - | |
4834 | | - | |
4835 | | - | |
| 4827 | + | |
| 4828 | + | |
| 4829 | + | |
| 4830 | + | |
| 4831 | + | |
| 4832 | + | |
| 4833 | + | |
| 4834 | + | |
| 4835 | + | |
| 4836 | + | |
| 4837 | + | |
| 4838 | + | |
| 4839 | + | |
| 4840 | + | |
| 4841 | + | |
| 4842 | + | |
| 4843 | + | |
4836 | 4844 | | |
4837 | 4845 | | |
4838 | 4846 | | |
| |||
4923 | 4931 | | |
4924 | 4932 | | |
4925 | 4933 | | |
4926 | | - | |
4927 | | - | |
| 4934 | + | |
| 4935 | + | |
| 4936 | + | |
| 4937 | + | |
4928 | 4938 | | |
4929 | 4939 | | |
4930 | 4940 | | |
| |||
5019 | 5029 | | |
5020 | 5030 | | |
5021 | 5031 | | |
| 5032 | + | |
5022 | 5033 | | |
5023 | 5034 | | |
5024 | 5035 | | |
| |||
0 commit comments