@@ -722,7 +722,7 @@ error:
static int
v9fs_vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
int err;
u32 perm;
@@ -156,7 +156,7 @@ extern void affs_free_bitmap(struct super_block *sb);
extern int affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len);
extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *);
extern int affs_unlink(struct inode *dir, struct dentry *dentry);
-extern int affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *);
+extern int affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *, const struct open_flags *);
extern int affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
extern int affs_rmdir(struct inode *dir, struct dentry *dentry);
extern int affs_link(struct dentry *olddentry, struct inode *dir,
@@ -255,7 +255,8 @@ affs_unlink(struct inode *dir, struct dentry *dentry)
}
int
-affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd)
+affs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
+ struct nameidata *nd, const struct open_flags *op)
{
struct super_block *sb = dir->i_sb;
struct inode *inode;
@@ -85,7 +85,7 @@ const struct file_operations bfs_dir_operations = {
extern void dump_imap(const char *, struct super_block *);
static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
int err;
struct inode *inode;
@@ -4854,7 +4854,8 @@ out_unlock:
}
static int btrfs_create(struct inode *dir, struct dentry *dentry,
- umode_t mode, struct nameidata *nd)
+ umode_t mode, struct nameidata *nd,
+ const struct open_flags *op)
{
struct btrfs_trans_handle *trans;
struct btrfs_root *root = BTRFS_I(dir)->root;
@@ -567,7 +567,8 @@ lookup_again:
if (ret < 0)
goto create_error;
start = jiffies;
- ret = vfs_create(dir->d_inode, next, S_IFREG, NULL);
+ ret = vfs_create(dir->d_inode, next, S_IFREG, NULL,
+ NULL);
cachefiles_hist(cachefiles_create_histogram, start);
if (ret < 0)
goto create_error;
@@ -700,7 +700,7 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry,
}
static int ceph_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
dout("create in dir %p dentry %p name '%.*s'\n",
dir, dentry, dentry->d_name.len, dentry->d_name.name);
@@ -137,7 +137,7 @@ cifs_bp_rename_retry:
int
cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
int rc = -ENOENT;
int xid;
@@ -30,7 +30,8 @@
#include "coda_int.h"
/* dir inode-ops */
-static int coda_create(struct inode *dir, struct dentry *new, umode_t mode, struct nameidata *nd);
+static int coda_create(struct inode *dir, struct dentry *new, umode_t mode,
+ struct nameidata *nd, const struct open_flags *op);
static struct dentry *coda_lookup(struct inode *dir, struct dentry *target, struct nameidata *nd);
static int coda_link(struct dentry *old_dentry, struct inode *dir_inode,
struct dentry *entry);
@@ -173,7 +173,8 @@ ecryptfs_do_create(struct inode *directory_inode,
inode = ERR_CAST(lower_dir_dentry);
goto out;
}
- rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode, NULL);
+ rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode,
+ NULL, NULL);
if (rc) {
printk(KERN_ERR "%s: Failure to create dentry in lower fs; "
"rc = [%d]\n", __func__, rc);
@@ -248,7 +249,7 @@ out:
*/
static int
ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry,
- umode_t mode, struct nameidata *nd)
+ umode_t mode, struct nameidata *nd, const struct open_flags *op)
{
struct inode *ecryptfs_inode;
int rc;
@@ -60,7 +60,7 @@ static struct dentry *exofs_lookup(struct inode *dir, struct dentry *dentry,
}
static int exofs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
struct inode *inode = exofs_new_inode(dir, mode);
int err = PTR_ERR(inode);
@@ -94,7 +94,9 @@ struct dentry *ext2_get_parent(struct dentry *child)
* If the create succeeds, we fill in the inode information
* with d_instantiate().
*/
-static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode, struct nameidata *nd)
+static int ext2_create (struct inode * dir, struct dentry * dentry,
+ umode_t mode, struct nameidata *nd,
+ const struct open_flags *op)
{
struct inode *inode;
@@ -1689,8 +1689,9 @@ static int ext3_add_nondir(handle_t *handle,
* If the create succeeds, we fill in the inode information
* with d_instantiate().
*/
-static int ext3_create (struct inode * dir, struct dentry * dentry, umode_t mode,
- struct nameidata *nd)
+static int ext3_create (struct inode * dir, struct dentry * dentry,
+ umode_t mode, struct nameidata *nd,
+ const struct open_flags *op)
{
handle_t *handle;
struct inode * inode;
@@ -1737,7 +1737,7 @@ static int ext4_add_nondir(handle_t *handle,
* with d_instantiate().
*/
static int ext4_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
handle_t *handle;
struct inode *inode;
@@ -265,7 +265,7 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name,
/***** Create a file */
static int msdos_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
struct super_block *sb = dir->i_sb;
struct inode *inode = NULL;
@@ -772,7 +772,7 @@ error:
}
static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
struct super_block *sb = dir->i_sb;
struct inode *inode;
@@ -574,7 +574,7 @@ static int fuse_mknod(struct inode *dir, struct dentry *entry, umode_t mode,
}
static int fuse_create(struct inode *dir, struct dentry *entry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
if (nd) {
int err = fuse_create_open(dir, entry, mode, nd);
@@ -755,7 +755,8 @@ fail:
*/
static int gfs2_create(struct inode *dir, struct dentry *dentry,
- umode_t mode, struct nameidata *nd)
+ umode_t mode, struct nameidata *nd,
+ const struct open_flags *op)
{
int excl = 0;
if (nd && (nd->flags & LOOKUP_EXCL))
@@ -187,7 +187,7 @@ static int hfs_dir_release(struct inode *inode, struct file *file)
* the directory and the name (and its length) of the new file.
*/
static int hfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
struct inode *inode;
int res;
@@ -453,8 +453,9 @@ out:
return res;
}
-static int hfsplus_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+static int hfsplus_create(struct inode *dir, struct dentry *dentry,
+ umode_t mode, struct nameidata *nd,
+ const struct open_flags *op)
{
return hfsplus_mknod(dir, dentry, mode, 0);
}
@@ -553,7 +553,7 @@ static int read_name(struct inode *ino, char *name)
}
int hostfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
struct inode *inode;
char *name;
@@ -564,7 +564,9 @@ static int hugetlbfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mod
return retval;
}
-static int hugetlbfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd)
+static int hugetlbfs_create(struct inode *dir, struct dentry *dentry,
+ umode_t mode, struct nameidata *nd,
+ const struct open_flags *op)
{
return hugetlbfs_mknod(dir, dentry, mode | S_IFREG, 0);
}
@@ -87,12 +87,6 @@ extern struct super_block *user_get_super(dev_t);
struct nameidata;
extern struct file *nameidata_to_filp(struct nameidata *);
extern void release_open_intent(struct nameidata *);
-struct open_flags {
- int open_flag;
- umode_t mode;
- int acc_mode;
- int intent;
-};
extern struct file *do_filp_open(int dfd, const char *pathname,
const struct open_flags *op, int lookup_flags);
extern struct file *do_file_open_root(struct dentry *, struct vfsmount *,
@@ -25,7 +25,7 @@
static int jffs2_readdir (struct file *, void *, filldir_t);
static int jffs2_create (struct inode *,struct dentry *,umode_t,
- struct nameidata *);
+ struct nameidata *, const struct open_flags *);
static struct dentry *jffs2_lookup (struct inode *,struct dentry *,
struct nameidata *);
static int jffs2_link (struct dentry *,struct inode *,struct dentry *);
@@ -175,7 +175,8 @@ static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir)
static int jffs2_create(struct inode *dir_i, struct dentry *dentry,
- umode_t mode, struct nameidata *nd)
+ umode_t mode, struct nameidata *nd,
+ const struct open_flags *op)
{
struct jffs2_raw_inode *ri;
struct jffs2_inode_info *f, *dir_f;
@@ -73,7 +73,7 @@ static inline void free_ea_wmap(struct inode *inode)
*
*/
static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
int rc = 0;
tid_t tid; /* transaction id */
@@ -502,7 +502,7 @@ static int logfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
}
static int logfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
struct inode *inode;
@@ -55,7 +55,7 @@ static int minix_mknod(struct inode * dir, struct dentry *dentry, umode_t mode,
}
static int minix_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
return minix_mknod(dir, dentry, mode, 0);
}
@@ -2057,7 +2057,7 @@ void unlock_rename(struct dentry *p1, struct dentry *p2)
}
int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
int error = may_create(dir, dentry);
@@ -2071,7 +2071,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
error = security_inode_create(dir, dentry, mode);
if (error)
return error;
- error = dir->i_op->create(dir, dentry, mode, nd);
+ error = dir->i_op->create(dir, dentry, mode, nd, op);
if (!error)
fsnotify_create(dir, dentry);
return error;
@@ -2278,7 +2278,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
error = security_path_mknod(&nd->path, dentry, mode, 0);
if (error)
goto exit_mutex_unlock;
- error = vfs_create(dir->d_inode, dentry, mode, nd);
+ error = vfs_create(dir->d_inode, dentry, mode, nd, op);
if (error)
goto exit_mutex_unlock;
mutex_unlock(&dir->d_inode->i_mutex);
@@ -2596,7 +2596,8 @@ SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, umode_t, mode,
goto out_drop_write;
switch (mode & S_IFMT) {
case 0: case S_IFREG:
- error = vfs_create(path.dentry->d_inode,dentry,mode,NULL);
+ error = vfs_create(path.dentry->d_inode,dentry,mode,
+ NULL, NULL);
break;
case S_IFCHR: case S_IFBLK:
error = vfs_mknod(path.dentry->d_inode,dentry,mode,
@@ -30,7 +30,8 @@ static void ncp_do_readdir(struct file *, void *, filldir_t,
static int ncp_readdir(struct file *, void *, filldir_t);
-static int ncp_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
+static int ncp_create(struct inode *, struct dentry *, umode_t,
+ struct nameidata *, const struct open_flags *);
static struct dentry *ncp_lookup(struct inode *, struct dentry *, struct nameidata *);
static int ncp_unlink(struct inode *, struct dentry *);
static int ncp_mkdir(struct inode *, struct dentry *, umode_t);
@@ -980,7 +981,7 @@ out:
}
static int ncp_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
return ncp_create_new(dir, dentry, mode, 0, 0);
}
@@ -47,7 +47,8 @@ static int nfs_opendir(struct inode *, struct file *);
static int nfs_closedir(struct inode *, struct file *);
static int nfs_readdir(struct file *, void *, filldir_t);
static struct dentry *nfs_lookup(struct inode *, struct dentry *, struct nameidata *);
-static int nfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
+static int nfs_create(struct inode *, struct dentry *, umode_t,
+ struct nameidata *, const struct open_flags *);
static int nfs_mkdir(struct inode *, struct dentry *, umode_t);
static int nfs_rmdir(struct inode *, struct dentry *);
static int nfs_unlink(struct inode *, struct dentry *);
@@ -1678,7 +1679,8 @@ out_error:
* reply path made it appear to have failed.
*/
static int nfs_create(struct inode *dir, struct dentry *dentry,
- umode_t mode, struct nameidata *nd)
+ umode_t mode, struct nameidata *nd,
+ const struct open_flags *op)
{
struct iattr attr;
int error;
@@ -1329,7 +1329,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
err = 0;
switch (type) {
case S_IFREG:
- host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
+ host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL, NULL);
if (!host_err)
nfsd_check_ignore_resizing(iap);
break;
@@ -1492,7 +1492,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
goto out;
}
- host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
+ host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL, NULL);
if (host_err < 0) {
fh_drop_write(fhp);
goto out_nfserr;
@@ -85,7 +85,7 @@ nilfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
* with d_instantiate().
*/
static int nilfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
struct inode *inode;
struct nilfs_transaction_info ti;
@@ -618,7 +618,8 @@ static int ocfs2_mkdir(struct inode *dir,
static int ocfs2_create(struct inode *dir,
struct dentry *dentry,
umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd,
+ const struct open_flags *op)
{
int ret;
@@ -285,7 +285,7 @@ static int omfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
}
static int omfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
return omfs_add_node(dir, dentry, mode | S_IFREG);
}
@@ -114,7 +114,8 @@ static int ramfs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
return retval;
}
-static int ramfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd)
+static int ramfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
+ struct nameidata *nd, const struct open_flags *op)
{
return ramfs_mknod(dir, dentry, mode | S_IFREG, 0);
}
@@ -572,8 +572,9 @@ static int new_inode_init(struct inode *inode, struct inode *dir, umode_t mode)
return 0;
}
-static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+static int reiserfs_create(struct inode *dir, struct dentry *dentry,
+ umode_t mode, struct nameidata *nd,
+ const struct open_flags *op)
{
int retval;
struct inode *inode;
@@ -80,7 +80,9 @@ static int sysv_mknod(struct inode * dir, struct dentry * dentry, umode_t mode,
return err;
}
-static int sysv_create(struct inode * dir, struct dentry * dentry, umode_t mode, struct nameidata *nd)
+static int sysv_create(struct inode * dir, struct dentry * dentry,
+ umode_t mode, struct nameidata *nd,
+ const struct open_flags *op)
{
return sysv_mknod(dir, dentry, mode, 0);
}
@@ -254,7 +254,7 @@ out:
}
static int ubifs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
struct inode *inode;
struct ubifs_info *c = dir->i_sb->s_fs_info;
@@ -551,7 +551,7 @@ static int udf_delete_entry(struct inode *inode, struct fileIdentDesc *fi,
}
static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
struct udf_fileident_bh fibh;
struct inode *inode;
@@ -71,7 +71,7 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, stru
* with d_instantiate().
*/
static int ufs_create (struct inode * dir, struct dentry * dentry, umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd, const struct open_flags *op)
{
struct inode *inode;
int err;
@@ -182,7 +182,8 @@ xfs_vn_create(
struct inode *dir,
struct dentry *dentry,
umode_t mode,
- struct nameidata *nd)
+ struct nameidata *nd,
+ const struct open_flags *op)
{
return xfs_vn_mknod(dir, dentry, mode, 0);
}
@@ -1173,6 +1173,14 @@ struct file_lock {
#define OFFT_OFFSET_MAX INT_LIMIT(off_t)
#endif
+/* Passed down to the VFS's create function */
+struct open_flags {
+ int open_flag;
+ umode_t mode;
+ int acc_mode;
+ int intent;
+};
+
#include <linux/fcntl.h>
extern void send_sigio(struct fown_struct *fown, int fd, int band);
@@ -1542,7 +1550,8 @@ extern void unlock_super(struct super_block *);
/*
* VFS helper functions..
*/
-extern int vfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
+extern int vfs_create(struct inode *, struct dentry *, umode_t,
+ struct nameidata *, const struct open_flags *op);
extern int vfs_mkdir(struct inode *, struct dentry *, umode_t);
extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
extern int vfs_symlink(struct inode *, struct dentry *, const char *);
@@ -1645,7 +1654,8 @@ struct inode_operations {
int (*readlink) (struct dentry *, char __user *,int);
void (*put_link) (struct dentry *, struct nameidata *, void *);
- int (*create) (struct inode *,struct dentry *,umode_t,struct nameidata *);
+ int (*create) (struct inode *,struct dentry *,umode_t,
+ struct nameidata *, const struct open_flags *);
int (*link) (struct dentry *,struct inode *,struct dentry *);
int (*unlink) (struct inode *,struct dentry *);
int (*symlink) (struct inode *,struct dentry *,const char *);
@@ -624,7 +624,7 @@ static struct file *do_create(struct ipc_namespace *ipc_ns, struct dentry *dir,
ret = mnt_want_write(ipc_ns->mq_mnt);
if (ret)
goto out;
- ret = vfs_create(dir->d_inode, dentry, mode, NULL);
+ ret = vfs_create(dir->d_inode, dentry, mode, NULL, NULL);
dentry->d_fsdata = NULL;
if (ret)
goto out_drop_write;
This allows the file systems access to the open flags, so they can take these into account when making allocation decisions for newly created inodes. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> --- fs/9p/vfs_inode.c | 2 +- fs/affs/affs.h | 2 +- fs/affs/namei.c | 3 ++- fs/bfs/dir.c | 2 +- fs/btrfs/inode.c | 3 ++- fs/cachefiles/namei.c | 3 ++- fs/ceph/dir.c | 2 +- fs/cifs/dir.c | 2 +- fs/coda/dir.c | 3 ++- fs/ecryptfs/inode.c | 5 +++-- fs/exofs/namei.c | 2 +- fs/ext2/namei.c | 4 +++- fs/ext3/namei.c | 5 +++-- fs/ext4/namei.c | 2 +- fs/fat/namei_msdos.c | 2 +- fs/fat/namei_vfat.c | 2 +- fs/fuse/dir.c | 2 +- fs/gfs2/inode.c | 3 ++- fs/hfs/dir.c | 2 +- fs/hfsplus/dir.c | 5 +++-- fs/hostfs/hostfs_kern.c | 2 +- fs/hugetlbfs/inode.c | 4 +++- fs/internal.h | 6 ------ fs/jffs2/dir.c | 5 +++-- fs/jfs/namei.c | 2 +- fs/logfs/dir.c | 2 +- fs/minix/namei.c | 2 +- fs/namei.c | 9 +++++---- fs/ncpfs/dir.c | 5 +++-- fs/nfs/dir.c | 6 ++++-- fs/nfsd/vfs.c | 4 ++-- fs/nilfs2/namei.c | 2 +- fs/ocfs2/namei.c | 3 ++- fs/omfs/dir.c | 2 +- fs/ramfs/inode.c | 3 ++- fs/reiserfs/namei.c | 5 +++-- fs/sysv/namei.c | 4 +++- fs/ubifs/dir.c | 2 +- fs/udf/namei.c | 2 +- fs/ufs/namei.c | 2 +- fs/xfs/xfs_iops.c | 3 ++- include/linux/fs.h | 14 ++++++++++++-- ipc/mqueue.c | 2 +- 43 files changed, 87 insertions(+), 60 deletions(-)