aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/block_dev.c14
-rw-r--r--fs/configfs/symlink.c16
-rw-r--r--fs/ecryptfs/main.c23
3 files changed, 24 insertions, 29 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 218408eed1bb..d06fe3c3dd3f 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1268,33 +1268,33 @@ EXPORT_SYMBOL(ioctl_by_bdev);
1268 * namespace if possible and return it. Return ERR_PTR(error) 1268 * namespace if possible and return it. Return ERR_PTR(error)
1269 * otherwise. 1269 * otherwise.
1270 */ 1270 */
1271struct block_device *lookup_bdev(const char *path) 1271struct block_device *lookup_bdev(const char *pathname)
1272{ 1272{
1273 struct block_device *bdev; 1273 struct block_device *bdev;
1274 struct inode *inode; 1274 struct inode *inode;
1275 struct nameidata nd; 1275 struct path path;
1276 int error; 1276 int error;
1277 1277
1278 if (!path || !*path) 1278 if (!pathname || !*pathname)
1279 return ERR_PTR(-EINVAL); 1279 return ERR_PTR(-EINVAL);
1280 1280
1281 error = path_lookup(path, LOOKUP_FOLLOW, &nd); 1281 error = kern_path(pathname, LOOKUP_FOLLOW, &path);
1282 if (error) 1282 if (error)
1283 return ERR_PTR(error); 1283 return ERR_PTR(error);
1284 1284
1285 inode = nd.path.dentry->d_inode; 1285 inode = path.dentry->d_inode;
1286 error = -ENOTBLK; 1286 error = -ENOTBLK;
1287 if (!S_ISBLK(inode->i_mode)) 1287 if (!S_ISBLK(inode->i_mode))
1288 goto fail; 1288 goto fail;
1289 error = -EACCES; 1289 error = -EACCES;
1290 if (nd.path.mnt->mnt_flags & MNT_NODEV) 1290 if (path.mnt->mnt_flags & MNT_NODEV)
1291 goto fail; 1291 goto fail;
1292 error = -ENOMEM; 1292 error = -ENOMEM;
1293 bdev = bd_acquire(inode); 1293 bdev = bd_acquire(inode);
1294 if (!bdev) 1294 if (!bdev)
1295 goto fail; 1295 goto fail;
1296out: 1296out:
1297 path_put(&nd.path); 1297 path_put(&path);
1298 return bdev; 1298 return bdev;
1299fail: 1299fail:
1300 bdev = ERR_PTR(error); 1300 bdev = ERR_PTR(error);
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index bf74973b0492..932a92b31483 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -108,18 +108,18 @@ out:
108} 108}
109 109
110 110
111static int get_target(const char *symname, struct nameidata *nd, 111static int get_target(const char *symname, struct path *path,
112 struct config_item **target) 112 struct config_item **target)
113{ 113{
114 int ret; 114 int ret;
115 115
116 ret = path_lookup(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, nd); 116 ret = kern_path(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, path);
117 if (!ret) { 117 if (!ret) {
118 if (nd->path.dentry->d_sb == configfs_sb) { 118 if (path->dentry->d_sb == configfs_sb) {
119 *target = configfs_get_config_item(nd->path.dentry); 119 *target = configfs_get_config_item(path->dentry);
120 if (!*target) { 120 if (!*target) {
121 ret = -ENOENT; 121 ret = -ENOENT;
122 path_put(&nd->path); 122 path_put(path);
123 } 123 }
124 } else 124 } else
125 ret = -EPERM; 125 ret = -EPERM;
@@ -132,7 +132,7 @@ static int get_target(const char *symname, struct nameidata *nd,
132int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) 132int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
133{ 133{
134 int ret; 134 int ret;
135 struct nameidata nd; 135 struct path path;
136 struct configfs_dirent *sd; 136 struct configfs_dirent *sd;
137 struct config_item *parent_item; 137 struct config_item *parent_item;
138 struct config_item *target_item; 138 struct config_item *target_item;
@@ -159,7 +159,7 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
159 !type->ct_item_ops->allow_link) 159 !type->ct_item_ops->allow_link)
160 goto out_put; 160 goto out_put;
161 161
162 ret = get_target(symname, &nd, &target_item); 162 ret = get_target(symname, &path, &target_item);
163 if (ret) 163 if (ret)
164 goto out_put; 164 goto out_put;
165 165
@@ -174,7 +174,7 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
174 } 174 }
175 175
176 config_item_put(target_item); 176 config_item_put(target_item);
177 path_put(&nd.path); 177 path_put(&path);
178 178
179out_put: 179out_put:
180 config_item_put(parent_item); 180 config_item_put(parent_item);
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 046e027a4cb1..64d2ba980df4 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -471,31 +471,26 @@ out:
471 */ 471 */
472static int ecryptfs_read_super(struct super_block *sb, const char *dev_name) 472static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
473{ 473{
474 struct path path;
474 int rc; 475 int rc;
475 struct nameidata nd;
476 struct dentry *lower_root;
477 struct vfsmount *lower_mnt;
478 476
479 memset(&nd, 0, sizeof(struct nameidata)); 477 rc = kern_path(dev_name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
480 rc = path_lookup(dev_name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &nd);
481 if (rc) { 478 if (rc) {
482 ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n"); 479 ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n");
483 goto out; 480 goto out;
484 } 481 }
485 lower_root = nd.path.dentry; 482 ecryptfs_set_superblock_lower(sb, path.dentry->d_sb);
486 lower_mnt = nd.path.mnt; 483 sb->s_maxbytes = path.dentry->d_sb->s_maxbytes;
487 ecryptfs_set_superblock_lower(sb, lower_root->d_sb); 484 sb->s_blocksize = path.dentry->d_sb->s_blocksize;
488 sb->s_maxbytes = lower_root->d_sb->s_maxbytes; 485 ecryptfs_set_dentry_lower(sb->s_root, path.dentry);
489 sb->s_blocksize = lower_root->d_sb->s_blocksize; 486 ecryptfs_set_dentry_lower_mnt(sb->s_root, path.mnt);
490 ecryptfs_set_dentry_lower(sb->s_root, lower_root); 487 rc = ecryptfs_interpose(path.dentry, sb->s_root, sb, 0);
491 ecryptfs_set_dentry_lower_mnt(sb->s_root, lower_mnt);
492 rc = ecryptfs_interpose(lower_root, sb->s_root, sb, 0);
493 if (rc) 488 if (rc)
494 goto out_free; 489 goto out_free;
495 rc = 0; 490 rc = 0;
496 goto out; 491 goto out;
497out_free: 492out_free:
498 path_put(&nd.path); 493 path_put(&path);
499out: 494out:
500 return rc; 495 return rc;
501} 496}