1 From: Tony Jones <tonyj@suse.de>
2 Subject: Add struct vfsmount parameter to vfs_mkdir()
4 The vfsmount will be passed down to the LSM hook so that LSMs can compute
7 Signed-off-by: Tony Jones <tonyj@suse.de>
8 Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
9 Signed-off-by: John Johansen <jjohansen@suse.de>
12 fs/ecryptfs/inode.c | 5 ++++-
14 fs/nfsd/nfs4recover.c | 3 ++-
15 fs/nfsd/vfs.c | 8 +++++---
16 include/linux/fs.h | 2 +-
17 kernel/cgroup.c | 2 +-
18 6 files changed, 16 insertions(+), 9 deletions(-)
20 --- a/fs/ecryptfs/inode.c
21 +++ b/fs/ecryptfs/inode.c
22 @@ -501,11 +501,14 @@ static int ecryptfs_mkdir(struct inode *
25 struct dentry *lower_dentry;
26 + struct vfsmount *lower_mnt;
27 struct dentry *lower_dir_dentry;
29 lower_dentry = ecryptfs_dentry_to_lower(dentry);
30 + lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
31 lower_dir_dentry = lock_parent(lower_dentry);
32 - rc = vfs_mkdir(lower_dir_dentry->d_inode, lower_dentry, mode);
33 + rc = vfs_mkdir(lower_dir_dentry->d_inode, lower_dentry, lower_mnt,
35 if (rc || !lower_dentry->d_inode)
37 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0);
40 @@ -2077,7 +2077,8 @@ SYSCALL_DEFINE3(mknod, const char __user
41 return sys_mknodat(AT_FDCWD, filename, mode, dev);
44 -int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
45 +int vfs_mkdir(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
48 int error = may_create(dir, dentry, 1);
50 @@ -2120,7 +2121,7 @@ SYSCALL_DEFINE3(mkdirat, int, dfd, const
51 error = mnt_want_write(nd.path.mnt);
54 - error = vfs_mkdir(nd.path.dentry->d_inode, dentry, mode);
55 + error = vfs_mkdir(nd.path.dentry->d_inode, dentry, nd.path.mnt, mode);
56 mnt_drop_write(nd.path.mnt);
59 --- a/fs/nfsd/nfs4recover.c
60 +++ b/fs/nfsd/nfs4recover.c
61 @@ -158,7 +158,8 @@ nfsd4_create_clid_dir(struct nfs4_client
62 status = mnt_want_write(rec_dir.path.mnt);
65 - status = vfs_mkdir(rec_dir.path.dentry->d_inode, dentry, S_IRWXU);
66 + status = vfs_mkdir(rec_dir.path.dentry->d_inode, dentry,
67 + rec_dir.path.mnt, S_IRWXU);
68 mnt_drop_write(rec_dir.path.mnt);
73 @@ -1215,6 +1215,7 @@ nfsd_create(struct svc_rqst *rqstp, stru
74 int type, dev_t rdev, struct svc_fh *resfhp)
76 struct dentry *dentry, *dchild = NULL;
77 + struct svc_export *exp;
81 @@ -1232,6 +1233,7 @@ nfsd_create(struct svc_rqst *rqstp, stru
84 dentry = fhp->fh_dentry;
85 + exp = fhp->fh_export;
86 dirp = dentry->d_inode;
89 @@ -1248,7 +1250,7 @@ nfsd_create(struct svc_rqst *rqstp, stru
90 host_err = PTR_ERR(dchild);
93 - err = fh_compose(resfhp, fhp->fh_export, dchild, fhp);
94 + err = fh_compose(resfhp, exp, dchild, fhp);
98 @@ -1298,7 +1300,7 @@ nfsd_create(struct svc_rqst *rqstp, stru
99 host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
102 - host_err = vfs_mkdir(dirp, dchild, iap->ia_mode);
103 + host_err = vfs_mkdir(dirp, dchild, exp->ex_path.mnt, iap->ia_mode);
107 @@ -1312,7 +1314,7 @@ nfsd_create(struct svc_rqst *rqstp, stru
111 - if (EX_ISSYNC(fhp->fh_export)) {
112 + if (EX_ISSYNC(exp)) {
113 err = nfserrno(nfsd_sync_dir(dentry));
114 write_inode_now(dchild->d_inode, 1);
116 --- a/include/linux/fs.h
117 +++ b/include/linux/fs.h
118 @@ -1178,7 +1178,7 @@ extern void unlock_super(struct super_bl
120 extern int vfs_permission(struct nameidata *, int);
121 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
122 -extern int vfs_mkdir(struct inode *, struct dentry *, int);
123 +extern int vfs_mkdir(struct inode *, struct dentry *, struct vfsmount *, int);
124 extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
125 extern int vfs_symlink(struct inode *, struct dentry *, const char *);
126 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
127 --- a/kernel/cgroup.c
128 +++ b/kernel/cgroup.c
129 @@ -2911,7 +2911,7 @@ int cgroup_clone(struct task_struct *tsk
132 /* Create the cgroup directory, which also creates the cgroup */
133 - ret = vfs_mkdir(inode, dentry, S_IFDIR | 0755);
134 + ret = vfs_mkdir(inode, dentry, NULL, S_IFDIR | 0755);
135 child = __d_cgrp(dentry);