From patchwork Thu Feb 1 11:15:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Prasad N X-Patchwork-Id: 13540915 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 690B61F17B for ; Thu, 1 Feb 2024 11:15:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706786139; cv=none; b=lxnaJpFhkXcyv85yI8oPt3vv/61lX0hVNMqYvrZ7vEFfXDZ1V5EYh81i1WTMnfi/duc7LsQHiWWzoB9SOAit2eQZO5ZPkD94/WR0H9B4EaRrrPZZ7+PWQl3HxAuJKJyWXKhrIwDG801RhSauUFDX0b+ixoC7+cMSOUEP3fqEWwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706786139; c=relaxed/simple; bh=tc0U37Xi3ByFlkDdJoERrW0Ssh+9zfjEV3kY9r0T8II=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Ga49W21xMjJls/TgGwfSWBG+N15tWqykQ7rB8Mp6m+1dfjA8oIZwH9nxR1KHEkko2Bsi/lU7Yhve4JQnS4zaFCaqafsNuWLRRQdF+xA0bgD6X8XTSXw2dwqGHqSdGklPxp+NPuWq4KVccWNY6FIH0TgeVsE2JSZaU9dvmBzD0YU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LdJuK4Da; arc=none smtp.client-ip=209.85.214.172 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="LdJuK4Da" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1d95d67ff45so719245ad.2 for ; Thu, 01 Feb 2024 03:15:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706786137; x=1707390937; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=B2IS41f2qx2GaxxF8Ll3CrnxdEdvgw4trapXDmhY4kc=; b=LdJuK4DawryGVdUH19bX6jnE9IVVsHv8mnXsCRp6F7K8Gmc2seonEP2K8ijZ36WHTA HAJiEChiX2uMyw/tSORN2XrIi4XUse0N0fFmuwuzWzdEj8b4qnyCXHiZ+lNb2P/giTci AD2XuDYVHb6bsAksqLM1MGFUwwIsGlG+BWXsenSKEpMEXevorJtMRFIcZaCrMGRljOBe xECqkw20kNHRGz+e4ly184jqQrXBhWqnzHo7xa9Hpa5ez7LDXWUy1IMDIvGHKhNi1ATT 8+wlqYxl3F3oCeV1cu2Ao9+MsU9lrRiG7hFkUXj2J8LqRApt9XdB4cH23SeoGXgdyw06 qXSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706786137; x=1707390937; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=B2IS41f2qx2GaxxF8Ll3CrnxdEdvgw4trapXDmhY4kc=; b=TlyXtcUPHdENBLeyNC5LYU0+t7Tzc4m+QcsqmMgI50ltAcALGkD77eDPvk4/VqwTxM vQW1Z/PBdPKUrzxwZuYgCz0+QFLmBjNGeQr6NGjcCj981uNKUtxiSlq4eQ2VzytZW0NY 5hAp+tkqL9HvcpTP/qHmgGeMP2SzTxuEdZSqhsBTWUVSQFXOLA6Q/rW6zaPDRPTwP01c VjtE3rx8ZWwXU6TOyOi3lANnxbU+UIEqCV8HvBRi2kegablPXeeKdxJ1Pz+LIUKIFFDz QPoWb1LU/BdrnU9bUo4d2D+gdHmohCXfiJw3hey/eS0CaYPOmnGUASVze0PJoJ6zAxfg SMVw== X-Gm-Message-State: AOJu0Yz8K3OXBFHLT3/7DiiN4wctuz73Kg66dKbqeSIqYVj9C7kdDU3l BZanMFOpNVZpir9Xfp8/H6ynIADBspnt3hGTHjJNJqmPM6KQHkRMujo0frye X-Google-Smtp-Source: AGHT+IElj+eoqsVm8wXQwKh74+JbGRvfWuZ9uroY2gyfibUn5dckYHO5SkJMAIJaDTXvcfrEQSZZEQ== X-Received: by 2002:a17:902:c1d4:b0:1d7:92d7:5d1e with SMTP id c20-20020a170902c1d400b001d792d75d1emr4467243plc.15.1706786137043; Thu, 01 Feb 2024 03:15:37 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUAXMssok8xOu2rSSUpNHMWVQVnuIHETdw/+Xtz/rwI61PX3oMGlqM7OmbO2HEhb/1dFYw8BjbGCItn8AaHt5t3TE3bBoXnG/6wXSqKT6CdGJ5Yw9KZL9ujYSpO5deHPKy7wNWcpTRotH3PfZFT Received: from lindev-local-latest.corp.microsoft.com ([2404:f801:8028:1:7e0e:5dff:fea8:2c14]) by smtp.gmail.com with ESMTPSA id l19-20020a170902f69300b001d94c4938b3sm1129926plg.262.2024.02.01.03.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 03:15:36 -0800 (PST) From: nspmangalore@gmail.com X-Google-Original-From: sprasad@microsoft.com To: linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@manguebit.com, bharathsm@microsoft.com Cc: Shyam Prasad N Subject: [PATCH 1/5] cifs: avoid redundant calls to disable multichannel Date: Thu, 1 Feb 2024 11:15:26 +0000 Message-Id: <20240201111530.17194-1-sprasad@microsoft.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Shyam Prasad N When the server reports query network interface info call as unsupported following a tree connect, it means that multichannel is unsupported, even if the server capabilities report otherwise. When this happens, cifs_chan_skip_or_disable is called to disable multichannel on the client. However, we only need to call this when multichannel is currently setup. Fixes: f591062bdbf4 ("cifs: handle servers that still advertise multichannel after disabling") Signed-off-by: Shyam Prasad N --- fs/smb/client/smb2pdu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 3110aabc32c5..75713559e69f 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -419,7 +419,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon, rc = SMB3_request_interfaces(xid, tcon, false); free_xid(xid); - if (rc == -EOPNOTSUPP) { + if (rc == -EOPNOTSUPP && ses->chan_count > 1) { /* * some servers like Azure SMB server do not advertise * that multichannel has been disabled with server From patchwork Thu Feb 1 11:15:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Prasad N X-Patchwork-Id: 13540916 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 D4AA24DA09 for ; Thu, 1 Feb 2024 11:15:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706786146; cv=none; b=tBhYBerYcAVPkU88M0yKUG1O6xOzHw2ZZjvkQvrkJw91C0jCIXWGnGDNRl5lztGqoXfZjUCuUqiWba4kqjs2QhSDTNxA2xDwZ6l8oYXUQjRjifnYM8inBsLAe725bHtJWjzEAIpbHkxzOREGpzwUyoitp5axvjsHx7GYz/uN5RU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706786146; c=relaxed/simple; bh=jWCwM+dz7zmxxLgmoFUfeics0bg7kaREotoJtJzQMkI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VyR9659bqo97eO6gsUYizAV/pZvFdBh64z7Vc7di7eBo5QV8fl0UgQTOQV1vQN3Jocj0+TZR4caeU8aAWFq2+zgTT3TRhtAPAQcL3QLycfymbvvOLSEBbj0t4ZYipG6w0ncn8lA4ibxfcuntSlptOR9AxzB1qe7sD7GZsmDoFx4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lrmKmDuV; arc=none smtp.client-ip=209.85.214.178 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="lrmKmDuV" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1d780a392fdso6251515ad.3 for ; Thu, 01 Feb 2024 03:15:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706786143; x=1707390943; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mpkD3EdPNyQmzA1vf0wbH+Lbz7c9ADTNYXdIFyYPGuM=; b=lrmKmDuVOsJ6oDtsZVt/bG9svi9U3fqwpopjfNMqSoyQVDDTfz+ryEWy0xyaXEDhB0 Pf8cgdS1png8kl5gmrwGnFeeys3Y7yF1tCFQ+bLsSUhJX8oSt3uYcLxKrIShpNKjMn6C O3Uc3aW78OEqxQkugBqxkUCFmbio15iBqtxr0CfeW7WAK04L5zyK+6nyWwdV6IvzwI1s 582qHsOwQcw+oz8zfC9gSPFV/34Yq3fTnxzR9hPBi2LFw+rbHoDD3YyIbywt9bkcLcgx RWgKkiW/wBme77AvjWVTqJfXke3IqtRg5e2jBPEPdIiUAEhQjAkkyX0N0IDdiLXErFuF bA1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706786143; x=1707390943; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mpkD3EdPNyQmzA1vf0wbH+Lbz7c9ADTNYXdIFyYPGuM=; b=vQvrAtC+gMvHG0Nwu2MpXFfwSzmuoE74vDbjsaZ7uJvF87bFUzRy5fWvD5gL7EpRDi hyGbDbjPQ3OkunCJ6QUwgaZzVVinK1cskBBwgJaGEvV3p0gJo6TnrLhAe+jQ3ErFNkPp O6QZe9YbDoiy+5JtRTajcA9fjXcULrLcMEAXdS2YGtYotajD5gj7k4YKH1G5zN9CPwyP T2P5ESSFmB8E0cYcmHEPGEIToK6nH1F6eGD7nRVGrHQQ/jaIjNMyeQie0KWa2xxX4OW9 ymuskWyaatNBnwcIb76+4IzlqwYxBPoOqDExlhd9fXb3SLHCazOowWGtLFZHIOKqrbnE DG6Q== X-Gm-Message-State: AOJu0Yw47ixc9hbeZQgi0JT3BpLfQzUfmKeBBE0fdZt70AZlKaHlrVBJ Lm7pOFC4dA+/dJwg2gO8UG1+J2Csc1qbMtcDkaWWlt/b+5CDcrLe80gxCqFZ X-Google-Smtp-Source: AGHT+IFEk4vYxNtrrw+n2w/TFImv3keXbDhk2TJ4Pbc9YADyQYgIzb/2MGUUYClPO6ifrxJKI9bagQ== X-Received: by 2002:a17:903:4289:b0:1d8:d6f2:5ee0 with SMTP id ju9-20020a170903428900b001d8d6f25ee0mr1939947plb.8.1706786143202; Thu, 01 Feb 2024 03:15:43 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWPy5nE1hhFr83L0ao2qGG16BD7L3xhz4B8TN22AQV3Q7T45NWeBUYL2B5YDKn3OZcCLJJn+qrw2lv8N41jTByFz3vU5JO9GWjPdorcbl67tij6yo/GpVlZ/jEUDfnBNRDGgzzAfGwqZUXn8+KJ Received: from lindev-local-latest.corp.microsoft.com ([2404:f801:8028:1:7e0e:5dff:fea8:2c14]) by smtp.gmail.com with ESMTPSA id l19-20020a170902f69300b001d94c4938b3sm1129926plg.262.2024.02.01.03.15.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 03:15:42 -0800 (PST) From: nspmangalore@gmail.com X-Google-Original-From: sprasad@microsoft.com To: linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@manguebit.com, bharathsm@microsoft.com Cc: Shyam Prasad N Subject: [PATCH 2/5] cifs: change tcon status when need_reconnect is set on it Date: Thu, 1 Feb 2024 11:15:27 +0000 Message-Id: <20240201111530.17194-2-sprasad@microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240201111530.17194-1-sprasad@microsoft.com> References: <20240201111530.17194-1-sprasad@microsoft.com> Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Shyam Prasad N When a tcon is marked for need_reconnect, the intention is to have it reconnected. This change adjusts tcon->status in cifs_tree_connect when need_reconnect is set. Also, this change has a minor correction in resetting need_reconnect on success. It makes sure that it is done with tc_lock held. Signed-off-by: Shyam Prasad N --- fs/smb/client/connect.c | 5 +++++ fs/smb/client/dfs.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index c5cf88de32b7..28cacdd90bbf 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -4230,6 +4230,11 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru /* only send once per connect */ spin_lock(&tcon->tc_lock); + + /* if tcon is marked for needing reconnect, update state */ + if (tcon->need_reconnect) + tcon->status = TID_NEED_TCON; + if (tcon->status == TID_GOOD) { spin_unlock(&tcon->tc_lock); return 0; diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c index a8a1d386da65..449c59830039 100644 --- a/fs/smb/client/dfs.c +++ b/fs/smb/client/dfs.c @@ -565,6 +565,11 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru /* only send once per connect */ spin_lock(&tcon->tc_lock); + + /* if tcon is marked for needing reconnect, update state */ + if (tcon->need_reconnect) + tcon->status = TID_NEED_TCON; + if (tcon->status == TID_GOOD) { spin_unlock(&tcon->tc_lock); return 0; @@ -625,8 +630,8 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru spin_lock(&tcon->tc_lock); if (tcon->status == TID_IN_TCON) tcon->status = TID_GOOD; - spin_unlock(&tcon->tc_lock); tcon->need_reconnect = false; + spin_unlock(&tcon->tc_lock); } return rc; From patchwork Thu Feb 1 11:15:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Prasad N X-Patchwork-Id: 13540917 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 EEFC115B995 for ; Thu, 1 Feb 2024 11:15:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706786148; cv=none; b=cIQCpuJIeGH63vp653NTvUC3ZxiPaB/FJLALPs5GCYs9Y4vdzS8vK5NMAeo60CWMmBXutUhmdV2YSQ9DKZ1xcYB1GPexNp/bvSfrPdJHmrrE0u6f0ixELSJaeKk0YwFTKidU0Tfd0HluAnecT5xHKvVBQHmNIuUIL8mojficoUE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706786148; c=relaxed/simple; bh=oNmmTMO7rOwaVme3DvinibUY2cfpn+t6Zgwg8eU4VBs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=m5iFsqiEN47YzCL0KX5u8KTWxoH4rIbZWGs5gyF6T9MekNTT9XSSybP00Z9dOiR7k/pS5JtpTePv/EkQbLfsf234xulyDSsmCo4ghvhg3f21GeJqG6OZXy0MSvAci+zMuEW/4E2hk84G+NOzuns9M/5wjAfdvLzn6HaftVksHB0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EB35kQiz; arc=none smtp.client-ip=209.85.214.169 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="EB35kQiz" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d73066880eso6692645ad.3 for ; Thu, 01 Feb 2024 03:15:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706786146; x=1707390946; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UWYUhLumUFEGz6dKMdxqU7bBIDX9o62TKGXvyMevSgA=; b=EB35kQiz64wWL+llJ4EiaCN9QrD2SNshrbw9IwM4cXM3CS4//ZKKyowu1V97SYDOJU jSDrViRmrBiTAvOEseVoms+/5jTy2jkC+Pq/OCE0zpbVBCBoWvX4f2IQLJKQYHL7B++t /BuG6Sgb4Rlf9/PPBdGJn0lCRppzqnGgn03BdLD1M7CUMTtQI6eXJ5DUsH1hun5X71/M VjxA11OYBEAHEDdaxEA1WlXAZ2maRUj61cdbT0lri04XBkndc0bOGr6nXwkKyZl+glaj pGTwvsVVkZLY5IEkPtCa8+hu+xmmWqOPDdIVqCHZpW8jV4W12wCWtVpfe32RLfMkomMt F80Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706786146; x=1707390946; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UWYUhLumUFEGz6dKMdxqU7bBIDX9o62TKGXvyMevSgA=; b=TrjDyCbXP7+mGKBm1BybpYkq0idm1jrFr9BLGiokegJPJ7qIsjZOlPIlLKCeDW3z2T braQkZlhKRxirpTi7dvmtrd5E2YsQvxDx/wo5Jv/tozNB7PPJhkLDKhIMwEbZ71Qxw7M WtVXD1In3z+IinbCTN8wiGwfQgy3IJ8xzgcezLL7dIEI5476VodigrBTzryqw+WEX8iB 4qqPVCvrPJcRp8jWoqyXENmjuDFG5/zoiIaSsGTgWISnL45HvTbE3cUukZgraQ5dKzn1 0KU+7Hx8jQlBxp3+XcHzBPwGplCJgnq1eVRBxgGGJfjmDWDdpJOcbQkgQLgEVaE1e/z3 6GCA== X-Gm-Message-State: AOJu0YwbfVb8tjZRDoiUJvB2nSG6Vj3mbmDrd17+ScNnq2RCXYAA5rKr 8mHbkL0AHy1kXmzrclyOwSC+Wz+tSoHbp36adGcVPzJbix+iv1bU5JDQJ7z7 X-Google-Smtp-Source: AGHT+IE5sNL+4bDkBs3Jnigb9Gc/BZBNR64+sGn1VdPPJqd3wrW2uzpWqvv7Jjq4X/axHiSQAxchug== X-Received: by 2002:a17:903:248:b0:1d9:1359:75ec with SMTP id j8-20020a170903024800b001d9135975ecmr5825036plh.30.1706786145791; Thu, 01 Feb 2024 03:15:45 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVZC/SyF9RD80LDpn6oF/0lLzF63k03/+ccefA3gGh5SxiS387vbTGEFVbhwu4Z14FXdiHI1XGR8mYYfH5nTw4kNmVJYpVHpOD6EsQAl7Fr+f9CH/44vhJIzaEC/ClvVNIjnobHvBdlHfQ2EAjy Received: from lindev-local-latest.corp.microsoft.com ([2404:f801:8028:1:7e0e:5dff:fea8:2c14]) by smtp.gmail.com with ESMTPSA id l19-20020a170902f69300b001d94c4938b3sm1129926plg.262.2024.02.01.03.15.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 03:15:45 -0800 (PST) From: nspmangalore@gmail.com X-Google-Original-From: sprasad@microsoft.com To: linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@manguebit.com, bharathsm@microsoft.com Cc: Shyam Prasad N Subject: [PATCH 3/5] cifs: do not search for channel if server is terminating Date: Thu, 1 Feb 2024 11:15:28 +0000 Message-Id: <20240201111530.17194-3-sprasad@microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240201111530.17194-1-sprasad@microsoft.com> References: <20240201111530.17194-1-sprasad@microsoft.com> Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Shyam Prasad N In order to scale down the channels, the following sequence of operations happen: 1. server struct is marked for terminate 2. the channel is deallocated in the ses->chans array 3. at a later point the cifsd thread actually terminates the server Between 2 and 3, there can be calls to find the channel for a server struct. When that happens, there can be an ugly warning that's logged. But this is expected. So this change does two things: 1. in cifs_ses_get_chan_index, if server->terminate is set, return 2. always make sure server->terminate is set with chan_lock held Signed-off-by: Shyam Prasad N --- fs/smb/client/sess.c | 4 ++++ fs/smb/client/smb2pdu.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c index cde81042bebd..3d2548c35c9d 100644 --- a/fs/smb/client/sess.c +++ b/fs/smb/client/sess.c @@ -75,6 +75,10 @@ cifs_ses_get_chan_index(struct cifs_ses *ses, { unsigned int i; + /* if the channel is waiting for termination */ + if (server->terminate) + return CIFS_INVAL_CHAN_INDEX; + for (i = 0; i < ses->chan_count; i++) { if (ses->chans[i].server == server) return i; diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 75713559e69f..cf5665f6f220 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -178,6 +178,7 @@ cifs_chan_skip_or_disable(struct cifs_ses *ses, } ses->chans[chan_index].server = NULL; + server->terminate = true; spin_unlock(&ses->chan_lock); /* @@ -188,7 +189,6 @@ cifs_chan_skip_or_disable(struct cifs_ses *ses, */ cifs_put_tcp_session(server, from_reconnect); - server->terminate = true; cifs_signal_cifsd_for_reconnect(server, false); /* mark primary server as needing reconnect */ From patchwork Thu Feb 1 11:15:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Prasad N X-Patchwork-Id: 13540918 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (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 84DF615B995 for ; Thu, 1 Feb 2024 11:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706786151; cv=none; b=KZBlYfXgguuHMMPaVIjHl1TJu6zNEndLWfVPpRLQvf4RZrbnGjm6rPZnlvn0Vtdba1DaJUlvpxOIvN9exPlKibY5DoOBEgH1KmQLUA/xwqVfocxN5/mBqfuQ5Pzi+GQStRRHl7H4TzTzxLcj6rNg1BYaUi0rB4GbmIHxFd9bJn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706786151; c=relaxed/simple; bh=HCOcu/1rbGO5BBk94tFa9ME7lPJDOr2W8q6UVAEJNqk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FKR20YT6u6yaCZ8Q/qv9mHO5C6YxpXcFhAFKYSuYwbQ4rZJTLXZpG2WJVnLKy/ZNuym8jgCfE/M/fXLUisXjCu70sX8eCcZ2cf+87R+NQSI9V2785Eu7brPmb3shgIYtJrxJa0i7VwG8FoOaUsZAoXB1Ju4EZr9AWvk5Lq/AohM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IzUJ4qpb; arc=none smtp.client-ip=209.85.215.179 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="IzUJ4qpb" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-5d8b276979aso581842a12.2 for ; Thu, 01 Feb 2024 03:15:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706786148; x=1707390948; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Frl2WBgfcQjJvWCrb+CbUqOaJYs+6rcVF+uT2seRujQ=; b=IzUJ4qpbgbVhVWIWwFem6ijk/HKXrCyGtlfSlTXTu/3XIKJEght24HIqYQ7Tdq2/m4 /SRrCfafWX7fs5zvzUzCZbsUAj5Az37V6RjGXcb7jk0x0oWfsmUea7kM+yJ3xOOpArHD HuSBL6LHy5NYarHbDvtwI4sbeNidy8aiPTkMWvn15VgsPm1g2RbiGouLAU6nqfVAJaZA DJ2hdgIpVjhoBWrQcpVxq60S2cS+bylzvDqd+RRiVXFAxYfErcrREI3TdcF8PgRCCpVK nZ+NiOimy7j5XCsJWU8D1013t9tNO9C6RuQU/ZLg5NHGVQfijzEOOKsfFFL3AQTYPXwC rd4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706786148; x=1707390948; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Frl2WBgfcQjJvWCrb+CbUqOaJYs+6rcVF+uT2seRujQ=; b=VW/BfsuyiRkCuSG7y9ssQEs+WrbADSZltn6fZ3Pa9/M3OiWkLyBHrh8sd2FxTjf14M nYmd+i/Y2Ypah+wOp5NplKnA+wYL8q5R4JJXsiiYnWcH2gR5WxOtOYxNvQaf5LmSLsM2 zWeq9Bj86uJJISLiR47mfASdcjxl2TVC/ue51uY5srTUHin1wf9JBhlOEV17HhsNsxZn Xr3Y7jmRpgiEHllM3opnGqH9qLpGVEpxGhKq1SLWQqaGxEwK8ZhUd0Lq7u31yaYbPjWy Zk2D6pYQ6IspJeXk6KuQkisNxEqps2rqRhNxrG1UwKB/uc3jIbLk7V9W8nDewBaqca6r LkQA== X-Gm-Message-State: AOJu0YwNgG0PVqAH8Oe1O9UEooKa4yLaNoEujIPJR2T2vgq9NAvYqis5 YcgPZkZpRefII9T63OMLbdIHXV3uxFWRgHTIb0sUC3eSrI96LIFMCUv9Jyjr X-Google-Smtp-Source: AGHT+IH48XlmqjbCnQuy5MGjqtUQ8eXWgEQgKVAwtGYoC7FnBKNoVDQipxRfZVL3jWrRBQ/h5xyRFg== X-Received: by 2002:a05:6a20:1e8a:b0:19c:9419:1f37 with SMTP id dl10-20020a056a201e8a00b0019c94191f37mr3549896pzb.13.1706786148367; Thu, 01 Feb 2024 03:15:48 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWzhx/07OQ78AVVqULElFiAnO3JCWlsPlwsKUZ5JLDZfmkuQIVl3fHSNPsLQ2gwv+WlwNIxjhyUo2PgDRUdtpT62aBZzkUZ5tpo52ZgRBatxtTXmBsBni3lf9vl9i0PSy6gjaR6jcKKDeGN7uA+ Received: from lindev-local-latest.corp.microsoft.com ([2404:f801:8028:1:7e0e:5dff:fea8:2c14]) by smtp.gmail.com with ESMTPSA id l19-20020a170902f69300b001d94c4938b3sm1129926plg.262.2024.02.01.03.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 03:15:48 -0800 (PST) From: nspmangalore@gmail.com X-Google-Original-From: sprasad@microsoft.com To: linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@manguebit.com, bharathsm@microsoft.com Cc: Shyam Prasad N Subject: [PATCH 4/5] cifs: failure to add channel on iface should bump up weight Date: Thu, 1 Feb 2024 11:15:29 +0000 Message-Id: <20240201111530.17194-4-sprasad@microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240201111530.17194-1-sprasad@microsoft.com> References: <20240201111530.17194-1-sprasad@microsoft.com> Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Shyam Prasad N After the interface selection policy change to do a weighted round robin, each iface maintains a weight_fulfilled. When the weight_fulfilled reaches the total weight for the iface, we know that the weights can be reset and ifaces can be allocated from scratch again. During channel allocation failures on a particular channel, weight_fulfilled is not incremented. If a few interfaces are inactive, we could end up in a situation where the active interfaces are all allocated for the total_weight, and inactive ones are all that remain. This can cause a situation where no more channels can be allocated further. This change fixes it by increasing weight_fulfilled, even when channel allocation failure happens. This could mean that if there are temporary failures in channel allocation, the iface weights may not strictly be adhered to. But that's still okay. Fixes: a6d8fb54a515 ("cifs: distribute channels across interfaces based on speed") Signed-off-by: Shyam Prasad N --- fs/smb/client/sess.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c index 3d2548c35c9d..ed4bd88dd528 100644 --- a/fs/smb/client/sess.c +++ b/fs/smb/client/sess.c @@ -273,6 +273,8 @@ int cifs_try_adding_channels(struct cifs_ses *ses) &iface->sockaddr, rc); kref_put(&iface->refcount, release_iface); + /* failure to add chan should increase weight */ + iface->weight_fulfilled++; continue; } From patchwork Thu Feb 1 11:15:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Prasad N X-Patchwork-Id: 13540919 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 9C6BD4DA08 for ; Thu, 1 Feb 2024 11:15:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706786154; cv=none; b=kozvI/bMoadqXddoL0TpqIj+08TY8puAuDAvsTkgTWYzwRqhJCGPITTxCr9/5ZR8uXE5tVJ0I0lgkj9cyfYc1zf4NceN+gBvZYXAvD3eXTEJ/YGGov5kdGlERwHqK+KTA1YRCVe7cAtKPp21ObIxnlyR/qGy1zOUnL3fWONCavk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706786154; c=relaxed/simple; bh=tlfDvHzUHCHT6uLD8Au5OByKgIy1zAVj6JDmY9/3Ly4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uzUraWyR7XNLAlv9VF03xAOKoJ/Nu4eYv7yvm9ZmTewLWFuFja2GqmhA0SK48rLdWAabbEAkMQkNvVpl/u8UgTv/S6S3xoh24MFTnsucZ2x0XH8oKGcyNIvTi85W2puccP8M1NY8SWwyRvD46Ul/NVMe1ZZ1El+X1+jRVDfmdcM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=br3GanOw; arc=none smtp.client-ip=209.85.214.174 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="br3GanOw" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1d9607f2b3aso52285ad.0 for ; Thu, 01 Feb 2024 03:15:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706786151; x=1707390951; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KU+Oocemi+2CLgtXajNMOvK0OABANDk7iYuBTSElxY8=; b=br3GanOwwdasAQDCpln0e16TCm2KK2wmRUtXM6Cs8KIQAbTjcsET8zc4wam+TtH6o5 kUrsikuuKK3d25EWb6xSNn0ixhvEiRsPi/ICFIsz59L5Vqe13D5/VqQS7wRfhnpd8hKU 65LBeQySDxkohgFdIbBepmLD3j35k5uTpVzghWzfyj9dygtx8E3wy8R9T8IUvzvBywTL S1bgRMPz/t6+X+3qby5Hgd6N6RBBsqmjTanku8RUKqEgE3gFVGbm72M1ONQ9EHyFhfOC xu7NV4+oc+T6FpBA8Lo7Jb4bHoHyU06aWMVfAbojQxS3HwaSFy+yq7d9qD7uUbYw8c+/ HjGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706786151; x=1707390951; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KU+Oocemi+2CLgtXajNMOvK0OABANDk7iYuBTSElxY8=; b=EhEgEXY1kACP336C6NirLAUqdnxQ+QZz/Vf/OFdvXpMx/8EigWnmJNoyTuQZ3iUvAG si8k4ruMkbDb6KU7XZjTY9ETv1yU2+vUvKCv0x81IkLR1TgjkwRNmOTOYzuZpn5JSK0n guPlrqeCBGeWneCojutyz5VFlEFVSaZXXMhGeLQbFhrhmUlEZtMZRsNQSdT3elxahfgB Juh6PZDXnos+RRVL61ULbJwJGavg6G/4EHEcrYNNFEmefMwbpgmFF2uzX2W9OfAU/+m8 1rM62dQrF0Xe23XPHu4Gx0F9G4BpXRZ14c8ctFE5u/Hh9JbA8s9g5o7JCBY1FggMo6Lt BsZA== X-Gm-Message-State: AOJu0YyLJ6j8aY+J1j8laZxj788jAMEGVGpIKuVOVOBGbhZG1uNc4DOO yJ0UZbTYn6OLrhWbJFRhYCEraNehbssCzqS7YZ6Fzrcvq8WC5Vdig4+QsmAp X-Google-Smtp-Source: AGHT+IGe/szvWT7MskuGPTmV6Zr+ezo0ceDjSt4GwiccVopmh1TR4hy09m1+YhI5NBO2haLMJQX2oQ== X-Received: by 2002:a17:902:ac86:b0:1d8:ff72:eef8 with SMTP id h6-20020a170902ac8600b001d8ff72eef8mr8938697plr.18.1706786150966; Thu, 01 Feb 2024 03:15:50 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVqm6sHLGH61nsa5wDoQUgtLECqvqhU+JaUfG3yJyGP1zTFjxuIAv17FFle8/opR5ny874fmnt6fdAe/2R5rl0UGo1jVN9RBSQ9UjO4znJXb8yqzVE6IHL/kDWJyRjqyjaHYVHxsp/ETGk6jrQs Received: from lindev-local-latest.corp.microsoft.com ([2404:f801:8028:1:7e0e:5dff:fea8:2c14]) by smtp.gmail.com with ESMTPSA id l19-20020a170902f69300b001d94c4938b3sm1129926plg.262.2024.02.01.03.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 03:15:50 -0800 (PST) From: nspmangalore@gmail.com X-Google-Original-From: sprasad@microsoft.com To: linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@manguebit.com, bharathsm@microsoft.com Cc: Shyam Prasad N Subject: [PATCH 5/5] cifs: enforce nosharesock when multichannel is used Date: Thu, 1 Feb 2024 11:15:30 +0000 Message-Id: <20240201111530.17194-5-sprasad@microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240201111530.17194-1-sprasad@microsoft.com> References: <20240201111530.17194-1-sprasad@microsoft.com> Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Shyam Prasad N In the current architecture, multiple sessions can share the primary channel, but secondary channels for each session is not shared. This can create two problems when primary channel is shared among several sessions. For one, there could be uneven utilization of channels due to this skew. Another major issue is how a cifsd thread can get to the channel for a secondary channel. The process is already cumbersome. We also need to find the right session for the server struct. To avoid both the problems, this change marks even the primary channel as nosharesock. Secondary channels are marked as nosharesock anyway. We can remove this when we fix the mchan architecture to share all channels. Signed-off-by: Shyam Prasad N --- fs/smb/client/fs_context.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index 82eafe0815dc..e7543574ea9e 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -1043,6 +1043,8 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, ctx->max_channels = 1; } else { ctx->multichannel = true; + /* enforce nosharesock */ + ctx->nosharesock = true; /* if number of channels not specified, default to 2 */ if (ctx->max_channels < 2) ctx->max_channels = 2;