Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp34450ybj; Fri, 8 May 2020 06:01:26 -0700 (PDT) X-Google-Smtp-Source: APiQypIWRc2gBTQ47NbENguOVZZe187Bc0VCWGQ2m4yrTyLrwbYmhq5+Al5Cwg+4N/uGmNkWXbgX X-Received: by 2002:a50:cfcb:: with SMTP id i11mr2135362edk.262.1588942886612; Fri, 08 May 2020 06:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588942886; cv=none; d=google.com; s=arc-20160816; b=pLCVLTzM9F7thMrSOQLzUkkQlGgiVzOBSA3diPS5mm2uxZ9aKYdAuIT3mQA5MXV0Wt IBTt/QWuyS8yimBAcPxlZgm1xV/t8l35z96cd7pqucnOXXuvQzGc2lhowue9orgp8Ntz HOgUxmPnVj9ae+61Q54ft/YtvIZ+C2odng0hy+Mi1H6gFss1zt2Ve2Y7Je4cfnsVMtpI tmQ3snMQ0ZvFIXSAcbU0nyhHXNEgN0vwQLCNQqcc0kNvT3xG1QggfRgkjE2sEGfzuhQq r9JGrO5s0B28I9eOcaNS4IfMnavgpHHiFgwPMBw2T+HKGJsoSNLV9qwbsmtOUW2Fw6U9 19dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uVhQ1wGAisfER/ELmrUl6da92FwZReP1kKbrQS2b+yk=; b=s0BjXwvXZgDg6VLxjuq3gC/lMKMOcEs/B2MHs3gptpuSBtrWyoRLomRmNeGdxd14KU psVaDlst3zc0kKnLUTPUOYzRcyc2uumy8qI3IZibGXdj4gwt2SkjCZPO2CHWW1URk/az yoIQN6NqNWXWcyviTa2uw+2AfaSRLU2X/e+Wr4CoTDz1lQNiIZT3VUX+ky+1ZQf/1Tic 8EOCagfeu1JcJxGv59mFUabSAndXsaT6Msv1CfMn/f6U9GhqlwwZ5Lmar/zAenQLNETS h4vwJqY764QjwhRaSM9L5szjjCdnQJecO/Zy0k//4ADWK+IDDTXv8ZCYKE48duvRFUsE nd+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YPv3BQdi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p3si932230edi.38.2020.05.08.06.00.58; Fri, 08 May 2020 06:01:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YPv3BQdi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729104AbgEHM7k (ORCPT + 99 others); Fri, 8 May 2020 08:59:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:34604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730025AbgEHMxH (ORCPT ); Fri, 8 May 2020 08:53:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8802824953; Fri, 8 May 2020 12:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942387; bh=CMnwyT2LMCD0EZriqR5rgqNhfdV0DFvfJcImtGsdcOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YPv3BQdi/HQMK52xkJIfc0RaJiP7TYdBumEaAiVa8YzjceVaEauU67Nl69xOyGtlQ mIdUofOZWqsFnGls9eP8jhELyiMHJi4RI847ZxKL7pKc8XxgdfPJqkQvHhfoAKVe71 HPg2b3ybBiaJn0JSKbzy3oJ8RihKEGDGCEs19kqA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Aurelien Aptel , Ronnie Sahlberg , Steve French , Sasha Levin Subject: [PATCH 5.4 24/50] cifs: do not share tcons with DFS Date: Fri, 8 May 2020 14:35:30 +0200 Message-Id: <20200508123046.763258087@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123043.085296641@linuxfoundation.org> References: <20200508123043.085296641@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paulo Alcantara [ Upstream commit 65303de829dd6d291a4947c1a31de31896f8a060 ] This disables tcon re-use for DFS shares. tcon->dfs_path stores the path that the tcon should connect to when doing failing over. If that tcon is used multiple times e.g. 2 mounts using it with different prefixpath, each will need a different dfs_path but there is only one tcon. The other solution would be to split the tcon in 2 tcons during failover but that is much harder. tcons could not be shared with DFS in cifs.ko because in a DFS namespace like: //domain/dfsroot -> /serverA/dfsroot, /serverB/dfsroot //serverA/dfsroot/link -> /serverA/target1/aa/bb //serverA/dfsroot/link2 -> /serverA/target1/cc/dd you can see that link and link2 are two DFS links that both resolve to the same target share (/serverA/target1), so cifs.ko will only contain a single tcon for both link and link2. The problem with that is, if we (auto)mount "link" and "link2", cifs.ko will only contain a single tcon for both DFS links so we couldn't perform failover or refresh the DFS cache for both links because tcon->dfs_path was set to either "link" or "link2", but not both -- which is wrong. Signed-off-by: Paulo Alcantara (SUSE) Reviewed-by: Aurelien Aptel Reviewed-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/connect.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 52589ea4e3c05..721b2560caa74 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3362,6 +3362,10 @@ cifs_find_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) spin_lock(&cifs_tcp_ses_lock); list_for_each(tmp, &ses->tcon_list) { tcon = list_entry(tmp, struct cifs_tcon, tcon_list); +#ifdef CONFIG_CIFS_DFS_UPCALL + if (tcon->dfs_path) + continue; +#endif if (!match_tcon(tcon, volume_info)) continue; ++tcon->tc_count; -- 2.20.1