[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a7cb5d59-8af5-47b2-8549-05c9322971e5@kernel.org>
Date: Tue, 12 Aug 2025 14:17:01 +0900
From: Damien Le Moal <dlemoal@...nel.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Rajeev Mishra <rajeevm@....com>, axboe@...nel.dk,
yukuai1@...weicloud.com, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] loop: use vfs_getattr_nosec() for accurate file size
On 8/12/25 1:28 PM, Al Viro wrote:
> On Tue, Aug 12, 2025 at 12:42:44PM +0900, Damien Le Moal wrote:
>
>> Since loff_t is "long long", so a signed type, I would keep this interface and
>> add a negative error check in the 2 call sites for get_size(). That is simpler.
>
> Umm... First of all, what's the point of separate get_size() and loop_get_size()?
> Another thing to watch out for - replacing file needs to be careful, lest you
> replace the old file that has come to fail vfs_getattr() with new one that
> does the same thing ;-)
I did a quick grep and missed the fact that get_size() is mostly used through
get_loop_size(). So yes, making these 2 a single function will be clearer.
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.
--
Damien Le Moal
Western Digital Research
Powered by blists - more mailing lists