[{"id":3683603,"web_url":"http://patchwork.ozlabs.org/comment/3683603/","msgid":"<afDr5VhyWx9MIQHU@suse.de>","list_archive_url":null,"date":"2026-04-28T17:27:53","subject":"Re: [PATCH v3 17/19] cifs: discard functions should not return\n failure","submitter":{"id":78375,"url":"http://patchwork.ozlabs.org/api/people/78375/","name":"Enzo Matsumiya","email":"ematsumiya@suse.de"},"content":"On 04/28, nspmangalore@gmail.com wrote:\n>From: Shyam Prasad N <sprasad@microsoft.com>\n>\n>If discard functions for readv and query_dir return error, the\n>callback functions can be skipped. This can end up with hung\n>syscalls due to the completion functions not getting called.\n>\n>This change ensures that both these discard functions return\n>success even when discard from socket returned error. This\n>ensures that at least after the mid for the response is found,\n>the callback doesn't get skipped, and we do not leave syscalls\n>waiting.\n\nThen we'll also be returning wrong errors to callers?\n\nEither way, if this is a special case for query dir, just\ncall __cifs_readv_discard() from the new\ncifs_query_dir_receive() and ignore the error there\n(but you really shouldn't).\n\n__cifs_readv_discard() is used in other places (mostly indirectly)\nand returns important errors from deep down cifs_readv_from_socket()\n(e.g. -ECONNABORTED, -ESHUTDOWN, -EINTR) so modifying it for all\ncallers doesn't sound good.\n\n>Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>\n>---\n> fs/smb/client/transport.c | 16 ++++++++--------\n> 1 file changed, 8 insertions(+), 8 deletions(-)\n>\n>diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c\n>index 1e9e6f3f9a06f..85fa5751781a8 100644\n>--- a/fs/smb/client/transport.c\n>+++ b/fs/smb/client/transport.c\n>@@ -1137,13 +1137,13 @@ static int\n> __cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid,\n> \t\t     bool malformed)\n> {\n>-\tint length;\n>-\n>-\tlength = cifs_discard_remaining_data(server);\n>+\tcifs_discard_remaining_data(server);\n> \tdequeue_mid(server, mid, malformed);\n> \tmid->resp_buf = server->smallbuf;\n> \tserver->smallbuf = NULL;\n>-\treturn length;\n>+\n>+\t/* Once the mid is dequeued, the callback must run to terminate the subreq. */\n>+\treturn 0;\n> }\n>\n> static int\n>@@ -1158,13 +1158,13 @@ static int\n> cifs_query_dir_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid,\n> \t\t      bool malformed)\n> {\n>-\tint length;\n>-\n>-\tlength = cifs_discard_remaining_data(server);\n>+\tcifs_discard_remaining_data(server);\n> \tdequeue_mid(server, mid, malformed);\n> \tmid->resp_buf = server->smallbuf;\n> \tserver->smallbuf = NULL;\n>-\treturn length;\n>+\n>+\t/* Once the mid is dequeued, the callback must run to complete qd_io->done. */\n>+\treturn 0;\n> }\n>\n> /*\n>-- \n>2.43.0\n>\n>","headers":{"Return-Path":"\n <linux-cifs+bounces-11261-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-cifs@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=X0LrqWT8;\n\tdkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=c9rH7dtH;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.a=rsa-sha256 header.s=susede2_rsa header.b=hCP90OEV;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=d7YCZN6l;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-cifs+bounces-11261-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.b=\"X0LrqWT8\";\n\tdkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de\n header.b=\"c9rH7dtH\";\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.b=\"hCP90OEV\";\n\tdkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de\n header.b=\"d7YCZN6l\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=195.135.223.130","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=suse.de","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=suse.de","smtp-out1.suse.de;\n\tnone"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4ncZ5KY5z1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 03:34:38 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id E453E30832F4\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 17:28:17 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 0B8FC32E68D;\n\tTue, 28 Apr 2026 17:28:10 +0000 (UTC)","from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id DD67744103C\n\tfor <linux-cifs@vger.kernel.org>; Tue, 28 Apr 2026 17:28:06 +0000 (UTC)","from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby smtp-out1.suse.de (Postfix) with ESMTPS id EF7B16A846;\n\tTue, 28 Apr 2026 17:28:04 +0000 (UTC)","from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 75BD9593B0;\n\tTue, 28 Apr 2026 17:28:04 +0000 (UTC)","from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n\tby imap1.dmz-prg2.suse.org with ESMTPSA\n\tid IGGSDiTu8GmyXgAAD6G6ig\n\t(envelope-from <ematsumiya@suse.de>); Tue, 28 Apr 2026 17:28:04 +0000"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777397289; cv=none;\n b=gWccnsM7r7WRdsuNaKk46GirRTxGhi5chTeli/TxXmiTbOn7GyfIfjdGuqmvymD2Y5PyiaTcyvTPo+lZb2BriV7Kxdce9uqmBhW8OoXjQxRHcVpVGm4JalqC7L5ZWbHbE6X2UP1dPJgY4XdaSs/K4xdBxphQXBUURibwx8XljAo=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777397289; c=relaxed/simple;\n\tbh=KPbX1pv30BTC0s3A7tmPtHp5/BDggebdBfVKS9thBXM=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=R0+80GwPeQNqmp+HH92ez+cSMaDK0fsFC/T7dYm9c5RzIR3E1NIESXczOEENfL6CwbK/k37F3+3CgSL9EJ3ZdQgwGpCMxdIBJRRDuvmK1YTSjEiTmaM3IY44s+iGTuhnZWEflX3qAFHaci4BZFjBFhzVDbb1QbCuPnOAkSAonEA=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=suse.de;\n spf=pass smtp.mailfrom=suse.de;\n dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.b=X0LrqWT8;\n dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de\n header.b=c9rH7dtH;\n dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.b=hCP90OEV;\n dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de\n header.b=d7YCZN6l; arc=none smtp.client-ip=195.135.223.130","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n\tt=1777397285;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:content-type:content-type:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=FWMBQQmIQlrOLGZvdct5Jnr66DK2Ly0a7v6fe55vrwQ=;\n\tb=X0LrqWT81acP9PlwDsO+mZcNWsg39GIAusBeCn67kd4nzKjQQucOyKhLE5TkoCu8QK4SuG\n\trlvtRb30wg0BHBmAN3WewpevS7jimsOMW3FG0WMfexAKbjyKt8xd71KarusneCA9cRkjMI\n\tD9TIY8EBqi8MVaLAKqkyJ8RdmLp7TTM=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n\ts=susede2_ed25519; t=1777397285;\n\th=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:content-type:content-type:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=FWMBQQmIQlrOLGZvdct5Jnr66DK2Ly0a7v6fe55vrwQ=;\n\tb=c9rH7dtHK0n5xavWlcOSbCVFsZxrcPC5EcNTPys0aIisbMQLdqEz8oua62HzLnAHHiOYdS\n\tg/I3kMaeERgNsBBQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n\tt=1777397284;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:content-type:content-type:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=FWMBQQmIQlrOLGZvdct5Jnr66DK2Ly0a7v6fe55vrwQ=;\n\tb=hCP90OEVxSywiLF6F+LnibgN6B+7t2m0KITdGENoRa2V4GHQx10sxDWK3LqM1bjBrAagqE\n\tLA6tVC5uxJnhfhB43y9Hvcu4VTDrmNRX5SaksrGtsqDC5Rskm8Zd7kDYDD5+/nAZ42Bfvk\n\t/vCjKI9FwmA4ru6o4FoiEttSuObT3n8=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n\ts=susede2_ed25519; t=1777397284;\n\th=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:content-type:content-type:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=FWMBQQmIQlrOLGZvdct5Jnr66DK2Ly0a7v6fe55vrwQ=;\n\tb=d7YCZN6lHzIV+RcyJrKTZGYM4SnBCXf6RpjdlGI23qIDLe87kjjemKCf+IKBIrvrVWVNI2\n\tK7/Kh5pCNOIBKzAw=="],"Date":"Tue, 28 Apr 2026 14:27:53 -0300","From":"Enzo Matsumiya <ematsumiya@suse.de>","To":"nspmangalore@gmail.com","Cc":"linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@manguebit.org,\n\tbharathsm@microsoft.com, dhowells@redhat.com, henrique.carvalho@suse.com,\n\tShyam Prasad N <sprasad@microsoft.com>","Subject":"Re: [PATCH v3 17/19] cifs: discard functions should not return\n failure","Message-ID":"<afDr5VhyWx9MIQHU@suse.de>","References":"<20260428160804.281745-1-sprasad@microsoft.com>\n <20260428160804.281745-17-sprasad@microsoft.com>","Precedence":"bulk","X-Mailing-List":"linux-cifs@vger.kernel.org","List-Id":"<linux-cifs.vger.kernel.org>","List-Subscribe":"<mailto:linux-cifs+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-cifs+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii; format=flowed","Content-Disposition":"inline","In-Reply-To":"<20260428160804.281745-17-sprasad@microsoft.com>","X-Spamd-Result":"default: False [-4.30 / 50.00];\n\tBAYES_HAM(-3.00)[100.00%];\n\tNEURAL_HAM_LONG(-1.00)[-1.000];\n\tNEURAL_HAM_SHORT(-0.20)[-1.000];\n\tMIME_GOOD(-0.10)[text/plain];\n\tFREEMAIL_ENVRCPT(0.00)[gmail.com];\n\tRCVD_TLS_ALL(0.00)[];\n\tFUZZY_RATELIMITED(0.00)[rspamd.com];\n\tARC_NA(0.00)[];\n\tRCVD_VIA_SMTP_AUTH(0.00)[];\n\tMISSING_XM_UA(0.00)[];\n\tTO_DN_SOME(0.00)[];\n\tMIME_TRACE(0.00)[0:+];\n\tFREEMAIL_TO(0.00)[gmail.com];\n\tMID_RHS_MATCH_FROM(0.00)[];\n\tDKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n\tFROM_HAS_DN(0.00)[];\n\tFREEMAIL_CC(0.00)[vger.kernel.org,gmail.com,manguebit.org,microsoft.com,redhat.com,suse.com];\n\tRCPT_COUNT_SEVEN(0.00)[8];\n\tFROM_EQ_ENVFROM(0.00)[];\n\tTO_MATCH_ENVRCPT_ALL(0.00)[];\n\tRCVD_COUNT_TWO(0.00)[2];\n\tDBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,imap1.dmz-prg2.suse.org:helo]","X-Spam-Flag":"NO","X-Spam-Score":"-4.30","X-Spam-Level":""}}]