summaryrefslogtreecommitdiff
path: root/fs/open.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-08-07 10:13:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-07 10:13:14 -0400
commite9d488c3114acb6a0a93e99c02f9cd1d656f46c7 (patch)
treeb0342f47b8bb8fa6af3a6d1416e9881ccdb00144 /fs/open.c
parent337684a1746f93ae107e05d90977b070bb7e39d8 (diff)
parent4af75df6a410ce76d9f60f27b07e5645ecc2c5ed (diff)
downloadlwn-e9d488c3114acb6a0a93e99c02f9cd1d656f46c7.tar.gz
lwn-e9d488c3114acb6a0a93e99c02f9cd1d656f46c7.zip
Merge tag 'binfmt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/binfmt_misc
Pull binfmt_misc update from James Bottomley: "This update is to allow architecture emulation containers to function such that the emulation binary can be housed outside the container itself. The container and fs parts both have acks from relevant experts. To use the new feature you have to add an F option to your binfmt_misc configuration" From the docs: "The usual behaviour of binfmt_misc is to spawn the binary lazily when the misc format file is invoked. However, this doesn't work very well in the face of mount namespaces and changeroots, so the F mode opens the binary as soon as the emulation is installed and uses the opened image to spawn the emulator, meaning it is always available once installed, regardless of how the environment changes" * tag 'binfmt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/binfmt_misc: binfmt_misc: add F option description to documentation binfmt_misc: add persistent opened binary handler for containers fs: add filp_clone_open API
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/open.c b/fs/open.c
index bf66cf1a9f5c..4fd6e256f4f4 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -998,6 +998,26 @@ struct file *file_open_root(struct dentry *dentry, struct vfsmount *mnt,
}
EXPORT_SYMBOL(file_open_root);
+struct file *filp_clone_open(struct file *oldfile)
+{
+ struct file *file;
+ int retval;
+
+ file = get_empty_filp();
+ if (IS_ERR(file))
+ return file;
+
+ file->f_flags = oldfile->f_flags;
+ retval = vfs_open(&oldfile->f_path, file, oldfile->f_cred);
+ if (retval) {
+ put_filp(file);
+ return ERR_PTR(retval);
+ }
+
+ return file;
+}
+EXPORT_SYMBOL(filp_clone_open);
+
long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
{
struct open_flags op;