Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Enzo Matsumiya <ematsumiya@suse.de>
To: nspmangalore@gmail.com
Cc: linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@manguebit.org,
	 bharathsm@microsoft.com, dhowells@redhat.com,
	henrique.carvalho@suse.com,
	 Shyam Prasad N <sprasad@microsoft.com>
Subject: Re: [PATCH v3 17/19] cifs: discard functions should not return failure
Date: Tue, 28 Apr 2026 14:27:53 -0300	[thread overview]
Message-ID: <afDr5VhyWx9MIQHU@suse.de> (raw)
In-Reply-To: <20260428160804.281745-17-sprasad@microsoft.com>

On 04/28, nspmangalore@gmail.com wrote:
>From: Shyam Prasad N <sprasad@microsoft.com>
>
>If discard functions for readv and query_dir return error, the
>callback functions can be skipped. This can end up with hung
>syscalls due to the completion functions not getting called.
>
>This change ensures that both these discard functions return
>success even when discard from socket returned error. This
>ensures that at least after the mid for the response is found,
>the callback doesn't get skipped, and we do not leave syscalls
>waiting.

Then we'll also be returning wrong errors to callers?

Either way, if this is a special case for query dir, just
call __cifs_readv_discard() from the new
cifs_query_dir_receive() and ignore the error there
(but you really shouldn't).

__cifs_readv_discard() is used in other places (mostly indirectly)
and returns important errors from deep down cifs_readv_from_socket()
(e.g. -ECONNABORTED, -ESHUTDOWN, -EINTR) so modifying it for all
callers doesn't sound good.

>Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
>---
> fs/smb/client/transport.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
>diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
>index 1e9e6f3f9a06f..85fa5751781a8 100644
>--- a/fs/smb/client/transport.c
>+++ b/fs/smb/client/transport.c
>@@ -1137,13 +1137,13 @@ static int
> __cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid,
> 		     bool malformed)
> {
>-	int length;
>-
>-	length = cifs_discard_remaining_data(server);
>+	cifs_discard_remaining_data(server);
> 	dequeue_mid(server, mid, malformed);
> 	mid->resp_buf = server->smallbuf;
> 	server->smallbuf = NULL;
>-	return length;
>+
>+	/* Once the mid is dequeued, the callback must run to terminate the subreq. */
>+	return 0;
> }
>
> static int
>@@ -1158,13 +1158,13 @@ static int
> cifs_query_dir_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid,
> 		      bool malformed)
> {
>-	int length;
>-
>-	length = cifs_discard_remaining_data(server);
>+	cifs_discard_remaining_data(server);
> 	dequeue_mid(server, mid, malformed);
> 	mid->resp_buf = server->smallbuf;
> 	server->smallbuf = NULL;
>-	return length;
>+
>+	/* Once the mid is dequeued, the callback must run to complete qd_io->done. */
>+	return 0;
> }
>
> /*
>-- 
>2.43.0
>
>

  reply	other threads:[~2026-04-28 17:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 16:07 [PATCH v3 01/19] cifs: change_conf needs to be called for session setup nspmangalore
2026-04-28 16:07 ` [PATCH v3 02/19] cifs: abort open_cached_dir if we don't request leases nspmangalore
2026-04-30 19:16   ` Steve French
2026-04-28 16:07 ` [PATCH v3 03/19] cifs: invalidate cfid on unlink/rename/rmdir nspmangalore
2026-04-28 17:28   ` Paulo Alcantara
2026-05-01  9:00     ` Shyam Prasad N
2026-04-28 16:07 ` [PATCH v3 04/19] cifs: define variable sized buffer for querydir responses nspmangalore
2026-04-28 16:07 ` [PATCH v3 05/19] cifs: optimize readdir for small directories nspmangalore
2026-04-28 16:07 ` [PATCH v3 06/19] cifs: optimize readdir for larger directories nspmangalore
2026-04-28 17:00   ` Enzo Matsumiya
2026-04-28 16:07 ` [PATCH v3 07/19] cifs: reorganize cached dir helpers nspmangalore
2026-04-28 16:07 ` [PATCH v3 08/19] cifs: make cfid locks more granular nspmangalore
2026-04-28 17:18   ` Enzo Matsumiya
2026-05-01 10:20     ` Shyam Prasad N
2026-04-28 16:07 ` [PATCH v3 09/19] cifs: query dir should reuse cfid even if not fully cached nspmangalore
2026-04-28 16:07 ` [PATCH v3 10/19] cifs: back cached_dirents with page cache nspmangalore
2026-04-28 16:07 ` [PATCH v3 11/19] cifs: in place changes to cached_dirents when dir lease is held nspmangalore
2026-04-28 16:07 ` [PATCH v3 12/19] cifs: register a shrinker to manage cached_dirents nspmangalore
2026-04-28 16:07 ` [PATCH v3 13/19] cifs: option to disable time-based eviction of cache nspmangalore
2026-04-28 16:07 ` [PATCH v3 14/19] cifs: option to set unlimited number of cached dirs nspmangalore
2026-04-28 16:08 ` [PATCH v3 15/19] cifs: allow dcache population to happen asynchronously nspmangalore
2026-04-28 16:08 ` [PATCH v3 16/19] cifs: trace points for cached_dir operations nspmangalore
2026-04-28 16:08 ` [PATCH v3 17/19] cifs: discard functions should not return failure nspmangalore
2026-04-28 17:27   ` Enzo Matsumiya [this message]
2026-05-01  8:19     ` Shyam Prasad N
2026-04-28 16:08 ` [PATCH v3 18/19] cifs: keep cfids in rbtree for efficient lookups nspmangalore
2026-04-28 16:08 ` [PATCH v3 19/19] cifs: invalidate cached_dirents if population aborted nspmangalore

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=afDr5VhyWx9MIQHU@suse.de \
    --to=ematsumiya@suse.de \
    --cc=bharathsm@microsoft.com \
    --cc=dhowells@redhat.com \
    --cc=henrique.carvalho@suse.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=nspmangalore@gmail.com \
    --cc=pc@manguebit.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox