Skip to content

Commit b1ab5fa

Browse files
Tetsuo Handaaxboe
authored andcommitted
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: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent e051bd0 commit b1ab5fa

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎drivers/block/loop.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
12041204
static int
12051205
loop_get_status(struct loop_device *lo, struct loop_info64 *info)
12061206
{
1207-
struct file *file;
1207+
struct path path;
12081208
struct kstat stat;
12091209
int ret;
12101210

@@ -1229,16 +1229,16 @@ loop_get_status(struct loop_device *lo, struct loop_info64 *info)
12291229
}
12301230

12311231
/* Drop lo_ctl_mutex while we call into the filesystem. */
1232-
file = get_file(lo->lo_backing_file);
1232+
path = lo->lo_backing_file->f_path;
1233+
path_get(&path);
12331234
mutex_unlock(&lo->lo_ctl_mutex);
1234-
ret = vfs_getattr(&file->f_path, &stat, STATX_INO,
1235-
AT_STATX_SYNC_AS_STAT);
1235+
ret = vfs_getattr(&path, &stat, STATX_INO, AT_STATX_SYNC_AS_STAT);
12361236
if (!ret) {
12371237
info->lo_device = huge_encode_dev(stat.dev);
12381238
info->lo_inode = stat.ino;
12391239
info->lo_rdevice = huge_encode_dev(stat.rdev);
12401240
}
1241-
fput(file);
1241+
path_put(&path);
12421242
return ret;
12431243
}
12441244

0 commit comments

Comments
 (0)