Skip to content

Commit 72a8e05

Browse files
committed
Merge tag 'ovl-fixes-5.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs
Pull overlayfs fix from Miklos Szeredi: "Add a temporary fix for posix acls on idmapped mounts introduced in this cycle. A proper fix will be added in the next cycle" * tag 'ovl-fixes-5.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs: ovl: turn off SB_POSIXACL with idmapped layers temporarily
2 parents 2985156 + 4a47c63 commit 72a8e05

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

Documentation/filesystems/overlayfs.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,10 @@ overlay filesystem and the value of st_ino for filesystem objects may not be
466466
persistent and could change even while the overlay filesystem is mounted, as
467467
summarized in the `Inode properties`_ table above.
468468

469+
4) "idmapped mounts"
470+
When the upper or lower layers are idmapped mounts overlayfs will be mounted
471+
without support for POSIX Access Control Lists (ACLs). This limitation will
472+
eventually be lifted.
469473

470474
Changes to underlying filesystems
471475
---------------------------------

fs/overlayfs/super.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,9 @@ ovl_posix_acl_xattr_get(const struct xattr_handler *handler,
10031003
struct dentry *dentry, struct inode *inode,
10041004
const char *name, void *buffer, size_t size)
10051005
{
1006+
if (!IS_POSIXACL(inode))
1007+
return -EOPNOTSUPP;
1008+
10061009
return ovl_xattr_get(dentry, inode, handler->name, buffer, size);
10071010
}
10081011

@@ -1018,6 +1021,9 @@ ovl_posix_acl_xattr_set(const struct xattr_handler *handler,
10181021
struct posix_acl *acl = NULL;
10191022
int err;
10201023

1024+
if (!IS_POSIXACL(inode))
1025+
return -EOPNOTSUPP;
1026+
10211027
/* Check that everything is OK before copy-up */
10221028
if (value) {
10231029
acl = posix_acl_from_xattr(&init_user_ns, value, size);
@@ -1960,6 +1966,20 @@ static struct dentry *ovl_get_root(struct super_block *sb,
19601966
return root;
19611967
}
19621968

1969+
static bool ovl_has_idmapped_layers(struct ovl_fs *ofs)
1970+
{
1971+
1972+
unsigned int i;
1973+
const struct vfsmount *mnt;
1974+
1975+
for (i = 0; i < ofs->numlayer; i++) {
1976+
mnt = ofs->layers[i].mnt;
1977+
if (mnt && is_idmapped_mnt(mnt))
1978+
return true;
1979+
}
1980+
return false;
1981+
}
1982+
19631983
static int ovl_fill_super(struct super_block *sb, void *data, int silent)
19641984
{
19651985
struct path upperpath = { };
@@ -2129,7 +2149,10 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
21292149
sb->s_xattr = ofs->config.userxattr ? ovl_user_xattr_handlers :
21302150
ovl_trusted_xattr_handlers;
21312151
sb->s_fs_info = ofs;
2132-
sb->s_flags |= SB_POSIXACL;
2152+
if (ovl_has_idmapped_layers(ofs))
2153+
pr_warn("POSIX ACLs are not yet supported with idmapped layers, mounting without ACL support.\n");
2154+
else
2155+
sb->s_flags |= SB_POSIXACL;
21332156
sb->s_iflags |= SB_I_SKIP_SYNC;
21342157

21352158
err = -ENOMEM;

0 commit comments

Comments
 (0)