aboutsummaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c14
1 files changed, 7 insertions, 7 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);