mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sohan Kunkerkar <sohank2602@gmail.com>
To: miklos@szeredi.hu, amir73il@gmail.com
Cc: linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sohan Kunkerkar <sohank2602@gmail.com>
Subject: [PATCH] overlayfs: add FS_ALLOW_IDMAP flag to enable idmapped mounts
Date: Fri, 15 Aug 2025 11:06:29 -0400	[thread overview]
Message-ID: <20250815150629.2097562-1-sohank2602@gmail.com> (raw)

OverlayFS already has comprehensive support for idmapped mounts through
its ovl_copyattr() function and proper mnt_idmap() handling throughout
the codebase. The infrastructure correctly maps UIDs/GIDs from idmapped
upper and lower layers.

However, the filesystem was missing the FS_ALLOW_IDMAP flag, which
caused mount_setattr() calls with MOUNT_ATTR_IDMAP to fail with -EINVAL.

This change enables idmapped mount support by adding the FS_ALLOW_IDMAP
flag to the overlayfs file_system_type, allowing containers and other
applications to use idmapped mounts with overlay filesystems.

Signed-off-by: Sohan Kunkerkar <sohank2602@gmail.com>
---
 fs/overlayfs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index e19940d64..c628f9179 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -1516,7 +1516,7 @@ struct file_system_type ovl_fs_type = {
 	.name			= "overlay",
 	.init_fs_context	= ovl_init_fs_context,
 	.parameters		= ovl_parameter_spec,
-	.fs_flags		= FS_USERNS_MOUNT,
+	.fs_flags		= FS_USERNS_MOUNT | FS_ALLOW_IDMAP,
 	.kill_sb		= kill_anon_super,
 };
 MODULE_ALIAS_FS("overlay");
-- 
2.50.1


             reply	other threads:[~2025-08-15 15:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-15 15:06 Sohan Kunkerkar [this message]
2025-08-15 15:30 ` Amir Goldstein
2025-08-19 11:18   ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250815150629.2097562-1-sohank2602@gmail.com \
    --to=sohank2602@gmail.com \
    --cc=amir73il@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®