block/loop: Don't grab "struct file" for vfs_getattr() operation.
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Thu, 8 Nov 2018 13:01:01 +0000 (14:01 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 8 Nov 2018 13:30:09 +0000 (06:30 -0700)
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>
drivers/block/loop.c

index cb0cc868507620513d3de7658ed1f6999ceaa965..a29ef169f360abcfa5ad7c395c27a69431a9d942 100644 (file)
@@ -1204,7 +1204,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
 static int
 loop_get_status(struct loop_device *lo, struct loop_info64 *info)
 {
-       struct file *file;
+       struct path path;
        struct kstat stat;
        int ret;
 
@@ -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. */
-       file = get_file(lo->lo_backing_file);
+       path = lo->lo_backing_file->f_path;
+       path_get(&path);
        mutex_unlock(&lo->lo_ctl_mutex);
-       ret = vfs_getattr(&file->f_path, &stat, STATX_INO,
-                         AT_STATX_SYNC_AS_STAT);
+       ret = vfs_getattr(&path, &stat, STATX_INO, AT_STATX_SYNC_AS_STAT);
        if (!ret) {
                info->lo_device = huge_encode_dev(stat.dev);
                info->lo_inode = stat.ino;
                info->lo_rdevice = huge_encode_dev(stat.rdev);
        }
-       fput(file);
+       path_put(&path);
        return ret;
 }