]>
Commit | Line | Data |
---|---|---|
8f69975d BS |
1 | From: Tony Jones <tonyj@suse.de> |
2 | Subject: Add struct vfsmount parameter to vfs_mkdir() | |
3 | ||
4 | The vfsmount will be passed down to the LSM hook so that LSMs can compute | |
5 | pathnames. | |
6 | ||
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> | |
10 | ||
11 | --- | |
12 | fs/ecryptfs/inode.c | 5 ++++- | |
13 | fs/namei.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(-) | |
19 | ||
20 | --- a/fs/ecryptfs/inode.c | |
21 | +++ b/fs/ecryptfs/inode.c | |
22 | @@ -501,11 +501,14 @@ static int ecryptfs_mkdir(struct inode * | |
23 | { | |
24 | int rc; | |
25 | struct dentry *lower_dentry; | |
26 | + struct vfsmount *lower_mnt; | |
27 | struct dentry *lower_dir_dentry; | |
28 | ||
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, | |
34 | + mode); | |
35 | if (rc || !lower_dentry->d_inode) | |
36 | goto out; | |
37 | rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0); | |
38 | --- a/fs/namei.c | |
39 | +++ b/fs/namei.c | |
40 | @@ -2077,7 +2077,8 @@ SYSCALL_DEFINE3(mknod, const char __user | |
41 | return sys_mknodat(AT_FDCWD, filename, mode, dev); | |
42 | } | |
43 | ||
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, | |
46 | + int mode) | |
47 | { | |
48 | int error = may_create(dir, dentry, 1); | |
49 | ||
50 | @@ -2120,7 +2121,7 @@ SYSCALL_DEFINE3(mkdirat, int, dfd, const | |
51 | error = mnt_want_write(nd.path.mnt); | |
52 | if (error) | |
53 | goto out_dput; | |
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); | |
57 | out_dput: | |
58 | dput(dentry); | |
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); | |
63 | if (status) | |
64 | goto out_put; | |
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); | |
69 | out_put: | |
70 | dput(dentry); | |
71 | --- a/fs/nfsd/vfs.c | |
72 | +++ b/fs/nfsd/vfs.c | |
73 | @@ -1215,6 +1215,7 @@ nfsd_create(struct svc_rqst *rqstp, stru | |
74 | int type, dev_t rdev, struct svc_fh *resfhp) | |
75 | { | |
76 | struct dentry *dentry, *dchild = NULL; | |
77 | + struct svc_export *exp; | |
78 | struct inode *dirp; | |
79 | __be32 err; | |
80 | __be32 err2; | |
81 | @@ -1232,6 +1233,7 @@ nfsd_create(struct svc_rqst *rqstp, stru | |
82 | goto out; | |
83 | ||
84 | dentry = fhp->fh_dentry; | |
85 | + exp = fhp->fh_export; | |
86 | dirp = dentry->d_inode; | |
87 | ||
88 | err = nfserr_notdir; | |
89 | @@ -1248,7 +1250,7 @@ nfsd_create(struct svc_rqst *rqstp, stru | |
90 | host_err = PTR_ERR(dchild); | |
91 | if (IS_ERR(dchild)) | |
92 | goto out_nfserr; | |
93 | - err = fh_compose(resfhp, fhp->fh_export, dchild, fhp); | |
94 | + err = fh_compose(resfhp, exp, dchild, fhp); | |
95 | if (err) | |
96 | goto out; | |
97 | } else { | |
98 | @@ -1298,7 +1300,7 @@ nfsd_create(struct svc_rqst *rqstp, stru | |
99 | host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL); | |
100 | break; | |
101 | case S_IFDIR: | |
102 | - host_err = vfs_mkdir(dirp, dchild, iap->ia_mode); | |
103 | + host_err = vfs_mkdir(dirp, dchild, exp->ex_path.mnt, iap->ia_mode); | |
104 | break; | |
105 | case S_IFCHR: | |
106 | case S_IFBLK: | |
107 | @@ -1312,7 +1314,7 @@ nfsd_create(struct svc_rqst *rqstp, stru | |
108 | goto out_nfserr; | |
109 | } | |
110 | ||
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); | |
115 | } | |
116 | --- a/include/linux/fs.h | |
117 | +++ b/include/linux/fs.h | |
118 | @@ -1178,7 +1178,7 @@ extern void unlock_super(struct super_bl | |
119 | */ | |
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 | |
130 | } | |
131 | ||
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); | |
136 | dput(dentry); | |
137 | if (ret) { |