aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/inode.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-06-25 21:08:31 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-20 01:43:54 -0400
commitbf6c7f6c7bd0ea779757d35b5fdc9f9157f056b3 (patch)
treeaed90f298856f286f84af6774ea30ade62c95294 /fs/ecryptfs/inode.c
parent8a5e929dd2e05ab4d3d89f58c5e8fca596af8f3a (diff)
don't pass nameidata to vfs_create() from ecryptfs_create()
Instead of playing with removal of LOOKUP_OPEN, mangling (and restoring) nd->path, just pass NULL to vfs_create(). The whole point of what's being done there is to suppress any attempts to open file by underlying fs, which is what nd == NULL indicates. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ecryptfs/inode.c')
-rw-r--r--fs/ecryptfs/inode.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 799e01055f22..340c657a108c 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -147,7 +147,6 @@ static int ecryptfs_interpose(struct dentry *lower_dentry,
147 * @lower_dir_inode: inode of the parent in the lower fs of the new file 147 * @lower_dir_inode: inode of the parent in the lower fs of the new file
148 * @dentry: New file's dentry 148 * @dentry: New file's dentry
149 * @mode: The mode of the new file 149 * @mode: The mode of the new file
150 * @nd: nameidata of ecryptfs' parent's dentry & vfsmount
151 * 150 *
152 * Creates the file in the lower file system. 151 * Creates the file in the lower file system.
153 * 152 *
@@ -155,31 +154,10 @@ static int ecryptfs_interpose(struct dentry *lower_dentry,
155 */ 154 */
156static int 155static int
157ecryptfs_create_underlying_file(struct inode *lower_dir_inode, 156ecryptfs_create_underlying_file(struct inode *lower_dir_inode,
158 struct dentry *dentry, int mode, 157 struct dentry *dentry, int mode)
159 struct nameidata *nd)
160{ 158{
161 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); 159 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
162 struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); 160 return vfs_create(lower_dir_inode, lower_dentry, mode, NULL);
163 struct dentry *dentry_save;
164 struct vfsmount *vfsmount_save;
165 unsigned int flags_save;
166 int rc;
167
168 if (nd) {
169 dentry_save = nd->path.dentry;
170 vfsmount_save = nd->path.mnt;
171 flags_save = nd->flags;
172 nd->path.dentry = lower_dentry;
173 nd->path.mnt = lower_mnt;
174 nd->flags &= ~LOOKUP_OPEN;
175 }
176 rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd);
177 if (nd) {
178 nd->path.dentry = dentry_save;
179 nd->path.mnt = vfsmount_save;
180 nd->flags = flags_save;
181 }
182 return rc;
183} 161}
184 162
185/** 163/**
@@ -197,8 +175,7 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode,
197 */ 175 */
198static int 176static int
199ecryptfs_do_create(struct inode *directory_inode, 177ecryptfs_do_create(struct inode *directory_inode,
200 struct dentry *ecryptfs_dentry, int mode, 178 struct dentry *ecryptfs_dentry, int mode)
201 struct nameidata *nd)
202{ 179{
203 int rc; 180 int rc;
204 struct dentry *lower_dentry; 181 struct dentry *lower_dentry;
@@ -213,7 +190,7 @@ ecryptfs_do_create(struct inode *directory_inode,
213 goto out; 190 goto out;
214 } 191 }
215 rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode, 192 rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode,
216 ecryptfs_dentry, mode, nd); 193 ecryptfs_dentry, mode);
217 if (rc) { 194 if (rc) {
218 printk(KERN_ERR "%s: Failure to create dentry in lower fs; " 195 printk(KERN_ERR "%s: Failure to create dentry in lower fs; "
219 "rc = [%d]\n", __func__, rc); 196 "rc = [%d]\n", __func__, rc);
@@ -294,7 +271,7 @@ ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry,
294 int rc; 271 int rc;
295 272
296 /* ecryptfs_do_create() calls ecryptfs_interpose() */ 273 /* ecryptfs_do_create() calls ecryptfs_interpose() */
297 rc = ecryptfs_do_create(directory_inode, ecryptfs_dentry, mode, nd); 274 rc = ecryptfs_do_create(directory_inode, ecryptfs_dentry, mode);
298 if (unlikely(rc)) { 275 if (unlikely(rc)) {
299 ecryptfs_printk(KERN_WARNING, "Failed to create file in" 276 ecryptfs_printk(KERN_WARNING, "Failed to create file in"
300 "lower filesystem\n"); 277 "lower filesystem\n");