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 05865b93f7e1..88a776fa0ef6 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1257,33 +1257,33 @@ EXPORT_SYMBOL(ioctl_by_bdev);
1257 * namespace if possible and return it. Return ERR_PTR(error) 1257 * namespace if possible and return it. Return ERR_PTR(error)
1258 * otherwise. 1258 * otherwise.
1259 */ 1259 */
1260struct block_device *lookup_bdev(const char *path) 1260struct block_device *lookup_bdev(const char *pathname)
1261{ 1261{
1262 struct block_device *bdev; 1262 struct block_device *bdev;
1263 struct inode *inode; 1263 struct inode *inode;
1264 struct nameidata nd; 1264 struct path path;
1265 int error; 1265 int error;
1266 1266
1267 if (!path || !*path) 1267 if (!pathname || !*pathname)
1268 return ERR_PTR(-EINVAL); 1268 return ERR_PTR(-EINVAL);
1269 1269
1270 error = path_lookup(path, LOOKUP_FOLLOW, &nd); 1270 error = kern_path(pathname, LOOKUP_FOLLOW, &path);
1271 if (error) 1271 if (error)
1272 return ERR_PTR(error); 1272 return ERR_PTR(error);
1273 1273
1274 inode = nd.path.dentry->d_inode; 1274 inode = path.dentry->d_inode;
1275 error = -ENOTBLK; 1275 error = -ENOTBLK;
1276 if (!S_ISBLK(inode->i_mode)) 1276 if (!S_ISBLK(inode->i_mode))
1277 goto fail; 1277 goto fail;
1278 error = -EACCES; 1278 error = -EACCES;
1279 if (nd.path.mnt->mnt_flags & MNT_NODEV) 1279 if (path.mnt->mnt_flags & MNT_NODEV)
1280 goto fail; 1280 goto fail;
1281 error = -ENOMEM; 1281 error = -ENOMEM;
1282 bdev = bd_acquire(inode); 1282 bdev = bd_acquire(inode);
1283 if (!bdev) 1283 if (!bdev)
1284 goto fail; 1284 goto fail;
1285out: 1285out:
1286 path_put(&nd.path); 1286 path_put(&path);
1287 return bdev; 1287 return bdev;
1288fail: 1288fail:
1289 bdev = ERR_PTR(error); 1289 bdev = ERR_PTR(error);