From patchwork Fri Dec 29 15:20:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 13506551 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED719125A4 for ; Fri, 29 Dec 2023 15:21:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lgFe0dA6" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2cb21afa6c1so87232821fa.0 for ; Fri, 29 Dec 2023 07:21:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703863267; x=1704468067; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=7b4hRkCIWNwz0efuRTyGM2JdTKDm3CGTpfPMo3fz3qQ=; b=lgFe0dA63LG7GNHKh7wYk867asjK2q9U+XoxAzEh/pykHjQJwxHnIWYeM13CAqTa3b JGIYHanCRHZEpJ8he6MiMX5hhs6IED63UkEYHY0h+q4m06yiIaPS9bLKYCUb2aaKKF1v 3DIxvgm46zFagkIc5HRjkg73zv0tejHcI4OjGOvGivC5NOxRElKwnwNtVPCai9mD9qPE Os8xbfuD4UG5we+da4z3uupYg+aVr3hk+O4SPaRLWarLlqywu8jo4Ow0QcRZIY2R1n4d Hwe3cmoaD3jKFedk4WSDaZ0eJeun0ok1U6njAmu8314ILIuGXmTlT2GbWNpvDku+vaPl gYlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703863267; x=1704468067; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=7b4hRkCIWNwz0efuRTyGM2JdTKDm3CGTpfPMo3fz3qQ=; b=YTOIZxETMqKYa35FRIJO1grCaOvTTOqLXATtonu6ebgTmsdxink3su6ioZHVaDJdZF rR0NjdyHP/+MF4D8++lG2ePu8U866lVADBiCDHYfkamkrfCyGdlOrJz+z6OgdayjuQX4 ClxYSLrO0Gp4Z7BWONFewcixRnWdMsHisH5leBTjeD7lCmtmPvfvKuoibnDP7Gfm0SqA /qElNDej+0m6KHoD3ztE5qeFknm9E3TBhNYFWdU+p4L44+5jXgyU38yr7S+TCwntGM+Q YKwQ/whj5sP/14qjSn60APn71YZVqwRjpQ0xwyRPSvoOzwblUzyjKKbIdRZgqvX9EZij E8vw== X-Gm-Message-State: AOJu0Yya0swR9At97W7GrpgxkF4gHHki3R7hV1wjpKpSF4pHEX6WHhFj T4cX5Cjbv7TMf5SK04MSVqiunouKVQ7PGwtM8rnWhJCT7tQ= X-Google-Smtp-Source: AGHT+IH9o0QqIvaVjCao3KfZdCd2/XbdcUbDRPbfBB2H2cXt37fabbGpFOrKRJCVHa55nQpV+Xgw5r6SszVCjDydDkY= X-Received: by 2002:a2e:9b4f:0:b0:2cc:e39c:9c2c with SMTP id o15-20020a2e9b4f000000b002cce39c9c2cmr1537078ljj.61.1703863266903; Fri, 29 Dec 2023 07:21:06 -0800 (PST) Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Steve French Date: Fri, 29 Dec 2023 09:20:54 -0600 Message-ID: Subject: Recent multichannel fixes for the client To: Shyam Prasad N , CIFS Cc: meetakshisetiyaoss@gmail.com, Paulo Alcantara , samba-technical Here is the set of important multichannel fixes that Shyam recently sent out, ordered the way he requested (and a few updated with missing tags as requested). They are applied to cifs-2.6.git for-next now From 27e1fd343f80168ff456785c2443136b6b7ca3cc Mon Sep 17 00:00:00 2001 From: Shyam Prasad N Date: Fri, 29 Dec 2023 11:30:07 +0000 Subject: [PATCH 1/5] cifs: after disabling multichannel, mark tcon for reconnect Once the server disables multichannel for an active multichannel session, on the following reconnect, the client would reduce the number of channels to 1. However, it could be the case that the tree connect was active on one of these disabled channels. This results in an unrecoverable state. This change fixes that by making sure that whenever a channel is being terminated, the session and tcon are marked for reconnect too. This could mean a few redundant tree connect calls to the server, but considering that this is not a frequent event, we should be okay. Fixes: ee1d21794e55 ("cifs: handle when server stops supporting multichannel") Signed-off-by: Shyam Prasad N Signed-off-by: Steve French --- fs/smb/client/connect.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index dd2a1fb65e71..560624189c8b 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -216,17 +216,21 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server, /* If server is a channel, select the primary channel */ pserver = SERVER_IS_CHAN(server) ? server->primary_server : server; + /* + * if the server has been marked for termination, there is a + * chance that the remaining channels all need reconnect. To be + * on the safer side, mark the session and trees for reconnect + * for this scenario. This might cause a few redundant session + * setup and tree connect requests, but it is better than not doing + * a tree connect when needed, and all following requests failing + */ + if (server->terminate) { + mark_smb_session = true; + server = pserver; + } spin_lock(&cifs_tcp_ses_lock); list_for_each_entry_safe(ses, nses, &pserver->smb_ses_list, smb_ses_list) { - /* - * if channel has been marked for termination, nothing to do - * for the channel. in fact, we cannot find the channel for the - * server. So safe to exit here - */ - if (server->terminate) - break; - /* check if iface is still active */ if (!cifs_chan_is_iface_active(ses, server)) cifs_chan_update_iface(ses, server); -- 2.40.1