summaryrefslogtreecommitdiff
path: root/fs/backing-file.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-05-22 09:23:18 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2024-05-22 09:23:18 -0700
commit0e22bedd758643bc2cc161d54aa181e329da0ab3 (patch)
tree73fd34e6567f36c423a1ff37bf34bff1b082ade8 /fs/backing-file.c
parent4f2d34b65b40937b43c38ba34ece5aa3bc210e0d (diff)
parente9229c18dae3b3c2556cea8413edd1f76c78d767 (diff)
Merge tag 'ovl-update-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs
Pull overlayfs updates from Miklos Szeredi: - Add tmpfile support - Clean up include * tag 'ovl-update-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs: ovl: remove duplicate included header ovl: remove upper umask handling from ovl_create_upper() ovl: implement tmpfile
Diffstat (limited to 'fs/backing-file.c')
-rw-r--r--fs/backing-file.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/backing-file.c b/fs/backing-file.c
index 740185198db34..afb557446c27c 100644
--- a/fs/backing-file.c
+++ b/fs/backing-file.c
@@ -52,6 +52,29 @@ struct file *backing_file_open(const struct path *user_path, int flags,
}
EXPORT_SYMBOL_GPL(backing_file_open);
+struct file *backing_tmpfile_open(const struct path *user_path, int flags,
+ const struct path *real_parentpath,
+ umode_t mode, const struct cred *cred)
+{
+ struct mnt_idmap *real_idmap = mnt_idmap(real_parentpath->mnt);
+ struct file *f;
+ int error;
+
+ f = alloc_empty_backing_file(flags, cred);
+ if (IS_ERR(f))
+ return f;
+
+ path_get(user_path);
+ *backing_file_user_path(f) = *user_path;
+ error = vfs_tmpfile(real_idmap, real_parentpath, f, mode);
+ if (error) {
+ fput(f);
+ f = ERR_PTR(error);
+ }
+ return f;
+}
+EXPORT_SYMBOL(backing_tmpfile_open);
+
struct backing_aio {
struct kiocb iocb;
refcount_t ref;