Skip to content

Commit bf1c82a

Browse files
Christian Braunertorvalds
authored andcommitted
cachefiles: do not yet allow on idmapped mounts
Based on discussions (e.g. in [1]) my understanding of cachefiles and the cachefiles userspace daemon is that it creates a cache on a local filesystem (e.g. ext4, xfs etc.) for a network filesystem. The way this is done is by writing "bind" to /dev/cachefiles and pointing it to the directory to use as the cache. Currently this directory can technically also be an idmapped mount but cachefiles aren't yet fully aware of such mounts and thus don't take the idmapping into account when creating cache entries. This could leave users confused as the ownership of the files wouldn't match to what they expressed in the idmapping. Block cache files on idmapped mounts until the fscache rework is done and we have ported it to support idmapped mounts. Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: David Howells <dhowells@redhat.com> Cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/lkml/20210303161528.n3jzg66ou2wa43qb@wittgenstein [1] Link: https://lore.kernel.org/r/20210316112257.2974212-1-christian.brauner@ubuntu.com/ # v1 Link: https://listman.redhat.com/archives/linux-cachefs/2021-March/msg00044.html # v2 Link: https://lore.kernel.org/r/20210319114146.410329-1-christian.brauner@ubuntu.com/ # v3 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7acac4b commit bf1c82a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

fs/cachefiles/bind.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache)
118118
cache->mnt = path.mnt;
119119
root = path.dentry;
120120

121+
ret = -EINVAL;
122+
if (mnt_user_ns(path.mnt) != &init_user_ns) {
123+
pr_warn("File cache on idmapped mounts not supported");
124+
goto error_unsupported;
125+
}
126+
121127
/* check parameters */
122128
ret = -EOPNOTSUPP;
123129
if (d_is_negative(root) ||

0 commit comments

Comments
 (0)