Commit b1ab5fa3 authored by Tetsuo Handa's avatar Tetsuo Handa Committed by Jens Axboe

block/loop: Don't grab "struct file" for vfs_getattr() operation.

vfs_getattr() needs "struct path" rather than "struct file".
Let's use path_get()/path_put() rather than get_file()/fput().
Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e051bd0d
...@@ -1204,7 +1204,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) ...@@ -1204,7 +1204,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
static int static int
loop_get_status(struct loop_device *lo, struct loop_info64 *info) loop_get_status(struct loop_device *lo, struct loop_info64 *info)
{ {
struct file *file; struct path path;
struct kstat stat; struct kstat stat;
int ret; int ret;
...@@ -1229,16 +1229,16 @@ loop_get_status(struct loop_device *lo, struct loop_info64 *info) ...@@ -1229,16 +1229,16 @@ loop_get_status(struct loop_device *lo, struct loop_info64 *info)
} }
/* Drop lo_ctl_mutex while we call into the filesystem. */ /* Drop lo_ctl_mutex while we call into the filesystem. */
file = get_file(lo->lo_backing_file); path = lo->lo_backing_file->f_path;
path_get(&path);
mutex_unlock(&lo->lo_ctl_mutex); mutex_unlock(&lo->lo_ctl_mutex);
ret = vfs_getattr(&file->f_path, &stat, STATX_INO, ret = vfs_getattr(&path, &stat, STATX_INO, AT_STATX_SYNC_AS_STAT);
AT_STATX_SYNC_AS_STAT);
if (!ret) { if (!ret) {
info->lo_device = huge_encode_dev(stat.dev); info->lo_device = huge_encode_dev(stat.dev);
info->lo_inode = stat.ino; info->lo_inode = stat.ino;
info->lo_rdevice = huge_encode_dev(stat.rdev); info->lo_rdevice = huge_encode_dev(stat.rdev);
} }
fput(file); path_put(&path);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment