Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tetsuo Handa and committed by
Jens Axboe
b1ab5fa3 e051bd0d

+5 -5
+5 -5
drivers/block/loop.c
··· 1204 1204 static int 1205 1205 loop_get_status(struct loop_device *lo, struct loop_info64 *info) 1206 1206 { 1207 - struct file *file; 1207 + struct path path; 1208 1208 struct kstat stat; 1209 1209 int ret; 1210 1210 ··· 1229 1229 } 1230 1230 1231 1231 /* 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); 1233 1234 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); 1236 1236 if (!ret) { 1237 1237 info->lo_device = huge_encode_dev(stat.dev); 1238 1238 info->lo_inode = stat.ino; 1239 1239 info->lo_rdevice = huge_encode_dev(stat.rdev); 1240 1240 } 1241 - fput(file); 1241 + path_put(&path); 1242 1242 return ret; 1243 1243 } 1244 1244