linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@manguebit.org>
To: David Howells <dhowells@redhat.com>, Steve French <sfrench@samba.org>
Cc: dhowells@redhat.com, Shyam Prasad N <sprasad@microsoft.com>,
	linux-cifs@vger.kernel.org, netfs@lists.linux.dev,
	linux-fsdevel@vger.kernel.org, stable@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cifs: Fix handling of a beyond-EOF DIO/unbuffered read over SMB2
Date: Wed, 03 Dec 2025 19:46:07 -0300	[thread overview]
Message-ID: <d519f5eb5d5072dca8a06c4e127b1a0c@manguebit.org> (raw)
In-Reply-To: <1961803.1764798927@warthog.procyon.org.uk>

David Howells <dhowells@redhat.com> writes:

> If a DIO read or an unbuffered read request extends beyond the EOF, the
> server will return a short read and a status code indicating that EOF was
> hit, which gets translated to -ENODATA.  Note that the client does not cap
> the request at i_size, but asks for the amount requested in case there's a
> race on the server with a third party.
>
> Now, on the client side, the request will get split into multiple
> subrequests if rsize is smaller than the full request size.  A subrequest
> that starts before or at the EOF and returns short data up to the EOF will
> be correctly handled, with the NETFS_SREQ_HIT_EOF flag being set,
> indicating to netfslib that we can't read more.
>
> If a subrequest, however, starts after the EOF and not at it, HIT_EOF will
> not be flagged, its error will be set to -ENODATA and it will be abandoned.
> This will cause the request as a whole to fail with -ENODATA.
>
> Fix this by setting NETFS_SREQ_HIT_EOF on any subrequest that lies beyond
> the EOF marker.
>
> Fixes: 1da29f2c39b6 ("netfs, cifs: Fix handling of short DIO read")
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Steve French <sfrench@samba.org>
> cc: Paulo Alcantara <pc@manguebit.org>
> cc: Shyam Prasad N <sprasad@microsoft.com>
> cc: linux-cifs@vger.kernel.org
> cc: netfs@lists.linux.dev
> cc: linux-fsdevel@vger.kernel.org

Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>

      reply	other threads:[~2025-12-03 22:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 17:45 [PATCH] cifs: Fix handling of a beyond-EOF DIO/unbuffered read over SMB1 David Howells
2025-12-03 18:01 ` Paulo Alcantara
2025-12-03 21:40   ` Steve French
2025-12-03 22:37   ` Steve French
2025-12-03 22:45     ` Paulo Alcantara
2025-12-03 21:53 ` David Howells
2025-12-03 21:55 ` [PATCH] cifs: Fix handling of a beyond-EOF DIO/unbuffered read over SMB2 David Howells
2025-12-03 22:46   ` Paulo Alcantara [this message]

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=d519f5eb5d5072dca8a06c4e127b1a0c@manguebit.org \
    --to=pc@manguebit.org \
    --cc=dhowells@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netfs@lists.linux.dev \
    --cc=sfrench@samba.org \
    --cc=sprasad@microsoft.com \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).