Re: [PATCH v2] loop: use vfs_getattr_nosec() for accurate file size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

在 2025/08/12 16:37, Christoph Hellwig 写道:
On Tue, Aug 12, 2025 at 02:17:01PM +0900, Damien Le Moal wrote:
And indeed, that:

	/* size of the new backing store needs to be the same */
         if (get_loop_size(lo, file) != get_loop_size(lo, old_file))
                 goto out_err;

Will need some massaging.

Why?  get_loop_size just derives the first arguments to get_size
from the passed in loop device in the same way the only other caller
to get_size does.  So we can just:

   1) convert loop_set_status to use get_loop_size
   2) Fold get_size into get_loop_size
   3) Maye rename get_size to lo_calculate_size to have a descriptive
      name while we're touching it?
   4) switch to vfs_getattr

This looks good, it's better to refactor a bit before switch to getattr,
and I agree still return 0 on failue is fine.

Thanks,
Kuai



.






[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux