[PATCH v2 03/16] fs/overlayfs: Introduce ovl_override_creds_light()

From: Vinicius Costa Gomes
Date: Wed Aug 21 2024 - 21:30:32 EST


Will be used when there are guarantees that the credentials usage
count is not modified in the critical section.

This is a temporary helper, that will be removed when all users are
converted to use the credentials GUARD() helpers.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@xxxxxxxxx>
---
fs/overlayfs/overlayfs.h | 1 +
fs/overlayfs/util.c | 7 +++++++
2 files changed, 8 insertions(+)

diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 0bfe35da4b7b..557d8c4e3a01 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -429,6 +429,7 @@ int ovl_want_write(struct dentry *dentry);
void ovl_drop_write(struct dentry *dentry);
struct dentry *ovl_workdir(struct dentry *dentry);
const struct cred *ovl_override_creds(struct super_block *sb);
+const struct cred *ovl_override_creds_light(struct super_block *sb);

static inline const struct cred *ovl_creds(struct super_block *sb)
{
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index edc9216f6e27..3525ede21600 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -68,6 +68,13 @@ const struct cred *ovl_override_creds(struct super_block *sb)
return override_creds(ofs->creator_cred);
}

+const struct cred *ovl_override_creds_light(struct super_block *sb)
+{
+ struct ovl_fs *ofs = OVL_FS(sb);
+
+ return override_creds_light(ofs->creator_cred);
+}
+
/*
* Check if underlying fs supports file handles and try to determine encoding
* type, in order to deduce maximum inode number used by fs.
--
2.46.0