Re: [PATCH v2] loop: use vfs_getattr_nosec() for accurate file size
From: Christoph Hellwig
Date: Tue Aug 12 2025 - 04:49:19 EST
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