On Mon, Aug 25, 2025 at 5:40 PM Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> wrote: > > From: Yu Kuai <yukuai3@xxxxxxxxxx> > > By default, /dev/sda is block specail file from devtmpfs, getattr will > return file size as zero, causing loop failed for raw block device. > > We can add bdev_statx() to return device size, however this may introduce > changes that are not acknowledged by user. Fix this problem by reverting > changes for block special file, file mapping host is set to bdev inode > while opening, and use i_size_read() directly to get device size. > > Fixes: 47b71abd5846 ("loop: use vfs_getattr_nosec for accurate file size") > Reported-by: kernel test robot <oliver.sang@xxxxxxxxx> > Closes: https://lore.kernel.org/oe-lkp/202508200409.b2459c02-lkp@xxxxxxxxx > Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx> > --- > Changes in v2: > - don't call vfs_getattr_nosec() for block special file path, by Ming Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx>