From patchwork Fri Dec 29 11:16:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Prasad N X-Patchwork-Id: 13506440 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 A8F9610A1C for ; Fri, 29 Dec 2023 11:16:27 +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="g22fvB6G" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-28caeaad2d8so316201a91.0 for ; Fri, 29 Dec 2023 03:16:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703848587; x=1704453387; 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=aNEoMbQsYY6VE/qFOjgIGkei4vYeIv4KMsEQLqKBWxA=; b=g22fvB6GBnBxfe/OFqMkQQzUrAG8ObG0mKwEvURYkOfaNc0rDEdJFa746i6tbKDYIF sXD1it9k6gbKtRXJeC9t0CmgkCsWfGWe6iw3+bNJdRil+Q4S36gPND+WryCS6GHMAMzc TlapogXs2tdRwiorrvTwuAkn+E7Bbpu+SoVKIUaurTfMRnigSag0ObQpv5ZRsKlNVJcH 2/G1f0QD9PUklJ5aN3RhR6ZbsYxm715fV+bvZxkrU1TlSY6SU7jVzrfsxCBICzVw9JuI 2t6HM2OxDKT0WdB30IILv0mPME9xqP4LuGqQ3/9uYRoJur22Ot68xYSJwnvjkeLAe8aE 3IOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703848587; x=1704453387; 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=aNEoMbQsYY6VE/qFOjgIGkei4vYeIv4KMsEQLqKBWxA=; b=JFASsJMfB2o87z7zImvpl1f3rdnGMmrMR3GbNj3CJ+A/4FwR4NEZuF19DPCm1iYL2i LcL1kT17s2FY2QI3Yt083HpB6Jn8vLSZOgWRGE6HojDDQpJ6GnaZ/4Ut0N4InyqzMjc4 ryJcbzDJ8X+6HAWR4SRRb7xu69wQvuMbgL5qaug2V1FD8wkQZ0PSJTFdBaAtjG+Sg0tt zM8dR1W9+DszOHIPrIU3ij9kmh/6HAIagZCZdeb7NluFJYn6By38k0JAtgyoTP/Sy6Sm USYOhU8ZHD/S7ka1nXXUW5KBx0I5kDhRN/r7irS6nAy9VP3x1lSAa3zNE9OjN5PJPV3j rd5Q== X-Gm-Message-State: AOJu0YwQbDvh0JgVoEAC6EQ1y3kf2l0yaB6OiC5Hh5yFWK9EEd4ZnuvB PdosT9gp4RQ/mT6t0vH5Xns= X-Google-Smtp-Source: AGHT+IHG3PpjruuF4RRQQB48wL815OjpK9GYyKWL7vg4YMiDt2n7FwdewQS2ztqeqDc4iTpTdGBaMg== X-Received: by 2002:a17:90a:af94:b0:28b:d90c:c724 with SMTP id w20-20020a17090aaf9400b0028bd90cc724mr3804243pjq.54.1703848586666; Fri, 29 Dec 2023 03:16:26 -0800 (PST) Received: from lindev-local-latest.corp.microsoft.com ([2404:f801:8028:3:7e0c:5dff:fea8:2c14]) by smtp.gmail.com with ESMTPSA id mf14-20020a17090b184e00b0028ae0184bfasm20347630pjb.49.2023.12.29.03.16.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 03:16:26 -0800 (PST) From: nspmangalore@gmail.com X-Google-Original-From: sprasad@microsoft.com To: smfrench@gmail.com, linux-cifs@vger.kernel.org, pc@manguebit.com, meetakshisetiyaoss@gmail.com Cc: Shyam Prasad N Subject: [PATCH 1/4] cifs: cifs_chan_is_iface_active should be called with chan_lock held Date: Fri, 29 Dec 2023 11:16:15 +0000 Message-Id: <20231229111618.38887-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 cifs_chan_is_iface_active checks the channels of a session to see if the associated iface is active. This should always happen with chan_lock held. However, these two callers of this function were missing this locking. This change makes sure the function calls are protected with proper locking. Signed-off-by: Shyam Prasad N --- fs/smb/client/connect.c | 7 +++++-- fs/smb/client/smb2ops.c | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index 8b7cffba1ad5..3052a208c6ca 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -232,10 +232,13 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server, spin_lock(&cifs_tcp_ses_lock); list_for_each_entry_safe(ses, nses, &pserver->smb_ses_list, smb_ses_list) { /* check if iface is still active */ - if (!cifs_chan_is_iface_active(ses, server)) + spin_lock(&ses->chan_lock); + if (!cifs_chan_is_iface_active(ses, server)) { + spin_unlock(&ses->chan_lock); cifs_chan_update_iface(ses, server); + spin_lock(&ses->chan_lock); + } - spin_lock(&ses->chan_lock); if (!mark_smb_session && cifs_chan_needs_reconnect(ses, server)) { spin_unlock(&ses->chan_lock); continue; diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index 441d144bd712..104c58df0368 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -784,9 +784,14 @@ SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon, bool in_ goto out; /* check if iface is still active */ + spin_lock(&ses->chan_lock); pserver = ses->chans[0].server; - if (pserver && !cifs_chan_is_iface_active(ses, pserver)) + if (pserver && !cifs_chan_is_iface_active(ses, pserver)) { + spin_unlock(&ses->chan_lock); cifs_chan_update_iface(ses, pserver); + spin_lock(&ses->chan_lock); + } + spin_unlock(&ses->chan_lock); out: kfree(out_buf); From patchwork Fri Dec 29 11:16:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Prasad N X-Patchwork-Id: 13506441 Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) (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 5DE4510A33 for ; Fri, 29 Dec 2023 11:16:30 +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="QOYCzWKj" Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3bbc755167fso1673408b6e.0 for ; Fri, 29 Dec 2023 03:16:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703848589; x=1704453389; 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=H0LV4eYf0ibBx+gg21ikm2S5xsE/JkugSj8XVbDVN5E=; b=QOYCzWKjGkxMtj3wxiZrv+bOj9yD0SheIhNoKFtYosd7TGhO8ZoCz3tWRfXNmjF9JS wX78YSTGV4PVm6mAFWTjOViHaoxCSn9GdPK5nYL3s4vmqSOCoFkGs21Xrmq4ACARxgWL /V+nUCXk+xBMhcU/eBl+HP1R2mbJl6OaJLJIVjT9lqoLz3uItms2iDsPa2m5r9IdNx3P 1GEK2ZlBtio7TCo4Mc4zkOLF5jojxiqzeNg3mYr/4CFcl+gPx2jAROXpt/Iig1DRT0fZ +1IeVnN5QvzZYxcdRNo1cBH9aPyri1oWFDGqbOiec927lp5bDykIacM+zG2y3lIfCC6X GnVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703848589; x=1704453389; 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=H0LV4eYf0ibBx+gg21ikm2S5xsE/JkugSj8XVbDVN5E=; b=LhQA3C2bl0XM7p96X/R7nu3VIPFSgNoqj5FAFI7C53xF++/uzmufHNS70JqQFjPaKD 5XMelB2zJ1sIXunw3xMoG/o7GPEjYrbcj7DROA52k3rr6IyedYRmGAUoJfDUIZV8DPJF bms+HxvKltY53WPbmFF7Qq7Ub8s8GeolU1GKkjjFxR70PysTUcCcJsTU0jAUghVAnbaH V6ZnznhYzJDc26aeYvrFYOK3Lm9zeqDHR1vBFiN/IK7lze53AvROV6ye+r8RMeXyap2W iqRbKMo3MeMJF7c+iMyGaJs4m8/O2HuSUoxFIQMHFHkfMBwqFvONQwm6Q7tzSE9x350h ms+w== X-Gm-Message-State: AOJu0YybAUlKZXL5sDwtns8UjZyz9XXbgY5Ak1Fp2S+wGBjyGygNtZv1 jQLl9LrTDAFZ+sWaw+r/aA4= X-Google-Smtp-Source: AGHT+IGykocyC/wrUoONbHj1/KWRWFUEY1Xs+1Cv9nMTRp6sUfS/8Qsa6T5+MPdXnTzTdwT2pSXKqQ== X-Received: by 2002:a05:6358:e485:b0:175:17c5:e0e6 with SMTP id by5-20020a056358e48500b0017517c5e0e6mr1674062rwb.61.1703848589380; Fri, 29 Dec 2023 03:16:29 -0800 (PST) Received: from lindev-local-latest.corp.microsoft.com ([2404:f801:8028:3:7e0c:5dff:fea8:2c14]) by smtp.gmail.com with ESMTPSA id mf14-20020a17090b184e00b0028ae0184bfasm20347630pjb.49.2023.12.29.03.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 03:16:28 -0800 (PST) From: nspmangalore@gmail.com X-Google-Original-From: sprasad@microsoft.com To: smfrench@gmail.com, linux-cifs@vger.kernel.org, pc@manguebit.com, meetakshisetiyaoss@gmail.com Cc: Shyam Prasad N Subject: [PATCH 2/4] cifs: do not depend on release_iface for maintaining iface_list Date: Fri, 29 Dec 2023 11:16:16 +0000 Message-Id: <20231229111618.38887-2-sprasad@microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231229111618.38887-1-sprasad@microsoft.com> References: <20231229111618.38887-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 parse_server_interfaces should be in complete charge of maintaining the iface_list linked list. Today, iface entries are removed from the list only when the last refcount is dropped. i.e. in release_iface. However, this can result in undercounting of refcount if the server stops advertising interfaces (which Azure SMB server does). This change puts parse_server_interfaces in full charge of maintaining the iface_list. So if an empty list is returned by the server, the entries in the list will immediately be removed. This way, a following call to the same function will not find entries in the list. Fixes: aa45dadd34e4 ("cifs: change iface_list from array to sorted linked list") Signed-off-by: Shyam Prasad N --- fs/smb/client/cifsglob.h | 1 - fs/smb/client/smb2ops.c | 27 +++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index ba80c854c9ca..f840756e0169 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -1014,7 +1014,6 @@ release_iface(struct kref *ref) struct cifs_server_iface *iface = container_of(ref, struct cifs_server_iface, refcount); - list_del_init(&iface->iface_head); kfree(iface); } diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index 104c58df0368..b813485c0e86 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -595,16 +595,12 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, } /* - * Go through iface_list and do kref_put to remove - * any unused ifaces. ifaces in use will be removed - * when the last user calls a kref_put on it + * Go through iface_list and mark them as inactive */ list_for_each_entry_safe(iface, niface, &ses->iface_list, - iface_head) { + iface_head) iface->is_active = 0; - kref_put(&iface->refcount, release_iface); - ses->iface_count--; - } + spin_unlock(&ses->iface_lock); /* @@ -678,10 +674,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, iface_head) { ret = iface_cmp(iface, &tmp_iface); if (!ret) { - /* just get a ref so that it doesn't get picked/freed */ iface->is_active = 1; - kref_get(&iface->refcount); - ses->iface_count++; spin_unlock(&ses->iface_lock); goto next_iface; } else if (ret < 0) { @@ -748,6 +741,20 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, } out: + /* + * Go through the list again and put the inactive entries + */ + spin_lock(&ses->iface_lock); + list_for_each_entry_safe(iface, niface, &ses->iface_list, + iface_head) { + if (!iface->is_active) { + list_del(&iface->iface_head); + kref_put(&iface->refcount, release_iface); + ses->iface_count--; + } + } + spin_unlock(&ses->iface_lock); + return rc; } From patchwork Fri Dec 29 11:16:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Prasad N X-Patchwork-Id: 13506442 Received: from mail-oa1-f53.google.com (mail-oa1-f53.google.com [209.85.160.53]) (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 01E8710A36 for ; Fri, 29 Dec 2023 11:16:32 +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="k1jqgZtO" Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-204301f2934so4917929fac.1 for ; Fri, 29 Dec 2023 03:16:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703848592; x=1704453392; 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=gEW/phCz+wqV6eqiM4uMTnsGnQEdVB91+sIAZ2ujQ/I=; b=k1jqgZtO6Oev6uRiA9QOqoJaUG0Fk7PSh09/aBU9M8APX9X/HMmcanlNdSGKyvykR/ y0JBP3rAEUNqPECykl6m4KfM0RXBvChNkoiJqit/KMUmanjqz3oojYl55aswkwV6L8Mm weMh3MkPh+TCsFgIoZ1rkv1hqLgwSsOL/cwc5h2AraQpchcdB0zWXY+lyeNNgZWxcbVQ RuL4KJTfj9RGiNlDx1LqffrgNn9aUbs/i+Zu+q5hCl8I/UcM8N3cRLBFLR5PY/tYdgQ1 FLLeg2ucSnWYEO9gHxJ7KeRfbSCFnRRBYjUJvE1F4JJiaTpHw1YC8/actj9xqXHs2VCh 0wnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703848592; x=1704453392; 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=gEW/phCz+wqV6eqiM4uMTnsGnQEdVB91+sIAZ2ujQ/I=; b=rThIfkt8z454tId1dU1bkWi6htCVbVFEFeeQcrp3CODYSdB8OJ44dMZ+3J7dyM3K/A oR1iUwcvZtmfOsaNn30aL/Hw/F/hL9wxM9DkCxJDi0jN0g+pMa3YXkTbLaycif8Mguxw ZwZg9kuYeimUrl7AaJeQNV1OdQhKt/OGYkeokCJgbZbxIC4r/GazZO+5nIScwtp8sCS+ w+tnaE7o8kDOzJqhl9LBz4N+m63XnpEe+MxzNByzG5bIwA8RWZ5McfuPXNT7JJ0FZtVn bDGnDDa+an4tj9enGvgp2f/2M+ARUuIYY0KUui3dpzD3tvLL2JZd/8KRzJmfi9FjLoo6 Qy/A== X-Gm-Message-State: AOJu0YxDqk6F7tK8p7ZWor9qszajzI+BL9sdeXJ9o2M3lydNMicde56V vqcTu5gAjtXb0P23ix88GEQ= X-Google-Smtp-Source: AGHT+IEwMFZGZDjOEyRYRhq+Af/7ztsiyOi+wLiwn4O24eaHReYnDU2zOOuqk5K7CUl20LXGEL5d9g== X-Received: by 2002:a05:6871:810:b0:203:f156:3e94 with SMTP id q16-20020a056871081000b00203f1563e94mr14494946oap.92.1703848591869; Fri, 29 Dec 2023 03:16:31 -0800 (PST) Received: from lindev-local-latest.corp.microsoft.com ([2404:f801:8028:3:7e0c:5dff:fea8:2c14]) by smtp.gmail.com with ESMTPSA id mf14-20020a17090b184e00b0028ae0184bfasm20347630pjb.49.2023.12.29.03.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 03:16:31 -0800 (PST) From: nspmangalore@gmail.com X-Google-Original-From: sprasad@microsoft.com To: smfrench@gmail.com, linux-cifs@vger.kernel.org, pc@manguebit.com, meetakshisetiyaoss@gmail.com Cc: Shyam Prasad N Subject: [PATCH 3/4] cifs: cifs_pick_channel should skip unhealthy channels Date: Fri, 29 Dec 2023 11:16:17 +0000 Message-Id: <20231229111618.38887-3-sprasad@microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231229111618.38887-1-sprasad@microsoft.com> References: <20231229111618.38887-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 cifs_pick_channel does not take into account the current state of the channel today. As a result, if some channels are unhealthy, they could still get picked, resulting in unnecessary errors. This change checks the channel transport status before making the choice. If all channels are unhealthy, the primary channel will be returned anyway. Signed-off-by: Shyam Prasad N --- fs/smb/client/transport.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c index 4f717ad7c21b..f8e6636e90a3 100644 --- a/fs/smb/client/transport.c +++ b/fs/smb/client/transport.c @@ -1026,6 +1026,19 @@ struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses) if (!server || server->terminate) continue; + /* + * do not pick a channel that's not healthy. + * if all channels are unhealthy, we'll use + * the primary channel + */ + spin_lock(&server->srv_lock); + if (server->tcpStatus != CifsNew && + server->tcpStatus != CifsGood) { + spin_unlock(&server->srv_lock); + continue; + } + spin_unlock(&server->srv_lock); + /* * strictly speaking, we should pick up req_lock to read * server->in_flight. But it shouldn't matter much here if we From patchwork Fri Dec 29 11:16:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Prasad N X-Patchwork-Id: 13506443 Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) (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 9A3DA10A1B for ; Fri, 29 Dec 2023 11:16:35 +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="mmcePY6X" Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-204fdd685fdso893092fac.2 for ; Fri, 29 Dec 2023 03:16:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703848594; x=1704453394; 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=WVwjTZpQPXw6hJ+MPHao/5EGGQg5qHnQKXAGEkHljDs=; b=mmcePY6Xk01bssNxznw2TEUgGoW3oP1Jlw1k9s02lXzarrgCyv9MFgISSpZJD9b83V 2WREtuhR6XJ+5reHek8pkFMri4E2GBaa8Jw5eXy+0sbGG/Bc5g1CGf6l1EO9zZn2TAWV nmElQcbCHdjXdBvYR07uzV1rR5iogwcSGzjXa7uusufQhRT2ZJktcj+sjftVQhvrIbj8 G7mB+8kbbYdhY3aSd0xjmBMCvcjyRMzqYI8VAadV2I1vuVpMVlwp824+n/wmzg139f+/ Kl3gL7z+6Dbi4izMkKStRvgSJV4Tg7u8c/CZSNNJ5m6PLyZlTEDoUrvYzRJfKVCr3uFY tIYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703848594; x=1704453394; 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=WVwjTZpQPXw6hJ+MPHao/5EGGQg5qHnQKXAGEkHljDs=; b=FxV8s8Vn2IoS7X55DjA6NoYFAXzKZOs5rSw1+3UcsK8/cgDCIYFChh9KcKz9B3rbBf 441X4fwSIrfrY1WGa3PtE11C/dO6ApxdZkGLqILXI5bLZXBRVwIYAp1FBk2lOkiC11Dt y2rigDqBpQzoWC68hkCWJ3p6kTVCjbUHwGF+U62mR1NoCau0PHeUBC077ANb3a181Ssu KDf8MMd6yHwtZQNTdcxWUx/Th56WyYGygKTM/T3q0+kk5q4YO0Qy5h0vZjZdexr4Zyhv NdKN2uAlFbjPMeCflssQj7pgGdfGBwpQMiTJGL7zls1JnObwzJbRfjWtOPLUDXyaajjD RjgA== X-Gm-Message-State: AOJu0YyetYo1g9MtnSaFs92SxeEo6P2gqbm4MtFrIQtu6epv6FTX1lad dismzL3FYOEpvRMGjMxHlws= X-Google-Smtp-Source: AGHT+IFxav5mrgGM+xj6ZRo6EvN7uhA8CNV09L9eJtxpEdy1yvWe43x0vSaWKgnx7hYhWrgM9Esl5g== X-Received: by 2002:a05:6359:1c13:b0:172:da29:a8c3 with SMTP id us19-20020a0563591c1300b00172da29a8c3mr9749360rwb.63.1703848594422; Fri, 29 Dec 2023 03:16:34 -0800 (PST) Received: from lindev-local-latest.corp.microsoft.com ([2404:f801:8028:3:7e0c:5dff:fea8:2c14]) by smtp.gmail.com with ESMTPSA id mf14-20020a17090b184e00b0028ae0184bfasm20347630pjb.49.2023.12.29.03.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 03:16:34 -0800 (PST) From: nspmangalore@gmail.com X-Google-Original-From: sprasad@microsoft.com To: smfrench@gmail.com, linux-cifs@vger.kernel.org, pc@manguebit.com, meetakshisetiyaoss@gmail.com Cc: Shyam Prasad N Subject: [PATCH 4/4] cifs: fix in logging in cifs_chan_update_iface Date: Fri, 29 Dec 2023 11:16:18 +0000 Message-Id: <20231229111618.38887-4-sprasad@microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231229111618.38887-1-sprasad@microsoft.com> References: <20231229111618.38887-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 Recently, cifs_chan_update_iface was modified to not remove an iface if a suitable replacement was not found. With that, there were two conditionals that were exactly the same. This change removes that extra condition check. Also, fixed a logging in the same function to indicate the correct message. Signed-off-by: Shyam Prasad N --- fs/smb/client/sess.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c index 2d3b332a79a1..a16e175731eb 100644 --- a/fs/smb/client/sess.c +++ b/fs/smb/client/sess.c @@ -440,8 +440,14 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) } if (!iface) { - cifs_dbg(FYI, "unable to get the interface matching: %pIS\n", - &ss); + if (!chan_index) + cifs_dbg(FYI, "unable to get the interface matching: %pIS\n", + &ss); + else { + cifs_dbg(FYI, "unable to find another interface to replace: %pIS\n", + &old_iface->sockaddr); + } + spin_unlock(&ses->iface_lock); return 0; } @@ -459,10 +465,6 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server) iface->weight_fulfilled++; kref_put(&old_iface->refcount, release_iface); - } else if (old_iface) { - /* if a new candidate is not found, keep things as is */ - cifs_dbg(FYI, "could not replace iface: %pIS\n", - &old_iface->sockaddr); } else if (!chan_index) { /* special case: update interface for primary channel */ if (iface) {