From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 305B713B2A7; Tue, 27 Feb 2024 13:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709040846; cv=none; b=agJ5neuGRoFi7sjqf0GU2HiPw+JHEL4A+PvOekrICawjfNIj4F0lJ5+ApgZzeJAEO/1YPUOlbGjMhO3toE7PNVpFcJg34oz+ePscL0Uce2iGGdZb84Dp2rt+7cWjUxq+OsFmXYvvc0bXXu0lDBWsj4x0O/pYVMk3X+m52JG7ILk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709040846; c=relaxed/simple; bh=tR/LiFgX1AZGniKTbDO79CWr6h58E4VFkvpnHBTZ7Yk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nXdNtNdZr85Fqc/QRzO5NWcCTjCSWdmco+SXKwJ3hCDN3tseYVXKwB9xnvk1ylrs2ZCDLhKXtV1ysPLCbjJgH2KkUBFh4rl5MZmgBPfRULk00q9+9VDTARDl7dgZ9IRdkAfRednw0Bqx7HSv8OjQnwqlnO97tA4fr5rFE+HnUZU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dLQn1hEo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="dLQn1hEo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB44BC433F1; Tue, 27 Feb 2024 13:34:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709040846; bh=tR/LiFgX1AZGniKTbDO79CWr6h58E4VFkvpnHBTZ7Yk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dLQn1hEosn+6sEnG3PN/A+uXvACWcCWgfVkWqaVtEal++FRzevf4okSkSnihhPYnG +NMfyLulaCQxhIhfS8BLR++JVx+AfCBTKWWlvlIzUJT93HtNCAWSLQpz38NRejvZLE 2qnFSpLOQkxfQqNMZrSEXECFb++OvCQU9fFNP5nA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shyam Prasad N , Steve French , Sasha Levin Subject: [PATCH 6.7 130/334] cifs: change tcon status when need_reconnect is set on it Date: Tue, 27 Feb 2024 14:19:48 +0100 Message-ID: <20240227131634.658831765@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240227131630.636392135@linuxfoundation.org> References: <20240227131630.636392135@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.7-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shyam Prasad N [ Upstream commit c6e02eefd6ace3da3369c764f15429f5647056af ] 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 Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/smb/client/connect.c | 5 +++++ fs/smb/client/dfs.c | 7 ++++++- fs/smb/client/file.c | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index ea1da3ce0d401..35fe70b872b57 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -4225,6 +4225,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 a8a1d386da656..449c59830039b 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; diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index 32a8525415d96..4cbb5487bd8d0 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -175,6 +175,9 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon) /* only send once per connect */ spin_lock(&tcon->tc_lock); + if (tcon->need_reconnect) + tcon->status = TID_NEED_RECON; + if (tcon->status != TID_NEED_RECON) { spin_unlock(&tcon->tc_lock); return; -- 2.43.0