]> Gentwo Git Trees - linux/.git/commit
ovl: add ovl_override_creator_creds cred guard
authorChristian Brauner <brauner@kernel.org>
Mon, 17 Nov 2025 09:34:38 +0000 (10:34 +0100)
committerChristian Brauner <brauner@kernel.org>
Wed, 19 Nov 2025 20:58:26 +0000 (21:58 +0100)
commitf37b334728814b14745e15d46f9eab73750b67ec
treeca52bed6d523674649c8f56112ab7c30043899fa
parent5c06bc9f060ce48aa87cabdcf3d9d6995362e501
ovl: add ovl_override_creator_creds cred guard

The current code to override credentials for creation operations is
pretty difficult to understand. We effectively override the credentials
twice:

(1) override with the mounter's credentials
(2) copy the mounts credentials and override the fs{g,u}id with the inode {u,g}id

And then we elide the revert because it would be an idempotent revert.
That elision doesn't buy us anything anymore though because I've made it
all work without any reference counting anyway. All it does is mix the
two credential overrides together.

We can use a cleanup guard to clarify the creation codepaths and make
them easier to understand.

This just introduces the cleanup guard keeping the patch reviewable.
We'll convert the caller in follow-up patches and then drop the
duplicated code.

Link: https://patch.msgid.link/20251117-work-ovl-cred-guard-prepare-v2-1-bd1c97a36d7b@kernel.org
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/overlayfs/dir.c