All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Rajeev Mishra <rajeevm@hpe.com>
Cc: axboe@kernel.dk, yukuai1@huaweicloud.com,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	dlemoal@kernel.org
Subject: Re: [PATCH v2] loop: use vfs_getattr_nosec() for accurate file size
Date: Tue, 12 Aug 2025 05:25:39 +0100	[thread overview]
Message-ID: <20250812042539.GT222315@ZenIV> (raw)
In-Reply-To: <20250812033201.225425-1-rajeevm@hpe.com>

On Tue, Aug 12, 2025 at 03:32:01AM +0000, Rajeev Mishra wrote:
> Hi Kuai,
> 
> Thank you for the feedback on the v2 patch regarding error handling.
> 
> Yu mentioned:
> > return 0 here is odd. Why not "return ret;" to propagate the error if any ?
> 
> I understand the concern about proper error propagation. However, there's a 
> type compatibility issue I'd like to discuss before implementing v3:
> 
> 1. Current function signature: `static loff_t get_size(...)` 
>    - Returns size as positive loff_t (unsigned 64-bit)  
>    - All callers expect non-negative size values
> 
> 2. vfs_getattr_nosec() error codes are negative integers (-ENOENT, -EIO, etc.)
>    - Returning `ret` would cast negative errors to huge positive numbers

Huh? loff_t is signed; had always been that way...

> 3. Current callers like loop_set_size() don't handle error checking

If you start returning errors, they ought to.  Incidentally, it might make
sense to return the size in bytes - just move the shift into loop_set_size()...

  parent reply	other threads:[~2025-08-12  4:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11 19:03 [PATCH v2] loop: use vfs_getattr_nosec() for accurate file size Rajeev Mishra
2025-08-12  1:40 ` Damien Le Moal
2025-08-12  2:05   ` Yu Kuai
2025-08-12  3:32     ` Rajeev Mishra
2025-08-12  3:42       ` Damien Le Moal
2025-08-12  4:28         ` Al Viro
2025-08-12  5:17           ` Damien Le Moal
2025-08-12  8:37             ` Christoph Hellwig
2025-08-12  9:34               ` Yu Kuai
2025-08-12  8:39         ` Christoph Hellwig
2025-08-12  4:25       ` Al Viro [this message]
2025-08-12  8:39 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250812042539.GT222315@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rajeevm@hpe.com \
    --cc=yukuai1@huaweicloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.