From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62EA6C43603 for ; Thu, 19 Dec 2019 10:58:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 353D524650 for ; Thu, 19 Dec 2019 10:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576753122; bh=B4LLbaPD9lZjvlYhf8iauFUWfU35JQItXDlt2u6gB1c=; h=Subject:To:Cc:From:Date:List-ID:From; b=xThOJfE50YmEpI8Wc3cyWtfnkMpnv1bWBmfcROL0oIgKQm3S9zAV+UgC9JFjmNVln bnYgVkKkxNftPl8Rnu4qPxtM1t23UH8vOO8VLbUY3F2okivBeFSw7J/g0Lmq9EZqNZ ZSapK1oisGXZqCpVXVTyHge2GaTby+dxB8/xj0Bw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726694AbfLSK6l (ORCPT ); Thu, 19 Dec 2019 05:58:41 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:49489 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726681AbfLSK6l (ORCPT ); Thu, 19 Dec 2019 05:58:41 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 3AFDE223F1; Thu, 19 Dec 2019 05:58:40 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 19 Dec 2019 05:58:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=0NuXtu SBazIFJsABlGo3wuWVIMOKbiW787HxOafYbAA=; b=SXvFU3qGjJsepFFwC2d8P7 RZkWcHN+970Mb8D6qSlx2NGSp2qrIwJll9a2KjbuGLnoXLvfXUnYRs2y8SPQUrCI 0CfQWcZ18PbAwA2YB+mdLRA3VIFhc3JnBJXjcTJwTWt5pCQ+UXn3BAac7kIHEYeZ w5SzB3J/5XLcqryN7use1ZTTAli4b+0606HlN1hOeQBGWCCAwHIvTtuBHkphy4JE DFlquaClXuvPHqCe2U1VQqTSEDwZY4IPbPGWpvu2ywBaat//u3aRj/LwTBCR3qSH Tg0dgRooCPhgOlLH5slL6CyIS9C7CybfeQQrV4/5hacstLSRg1ZATbr7HvSQmOtg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddgvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepkeefrdekiedrkeelrd dutdejnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomhen ucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 7A74930609D4; Thu, 19 Dec 2019 05:58:39 -0500 (EST) Subject: FAILED: patch "[PATCH] cifs: Fix retrieval of DFS referrals in cifs_mount()" failed to apply to 4.19-stable tree To: pc@cjr.nz, matthew.ruffell@canonical.com, stfrench@microsoft.com Cc: From: Date: Thu, 19 Dec 2019 11:58:38 +0100 Message-ID: <157675311816525@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 5bb30a4dd60e2a10a4de9932daff23e503f1dd2b Mon Sep 17 00:00:00 2001 From: "Paulo Alcantara (SUSE)" Date: Fri, 22 Nov 2019 12:30:56 -0300 Subject: [PATCH] cifs: Fix retrieval of DFS referrals in cifs_mount() Make sure that DFS referrals are sent to newly resolved root targets as in a multi tier DFS setup. Signed-off-by: Paulo Alcantara (SUSE) Link: https://lkml.kernel.org/r/05aa2995-e85e-0ff4-d003-5bb08bd17a22@canonical.com Cc: stable@vger.kernel.org Tested-by: Matthew Ruffell Signed-off-by: Steve French diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index f611163b5bc3..86d1baedf21c 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -4786,6 +4786,17 @@ static int is_path_remote(struct cifs_sb_info *cifs_sb, struct smb_vol *vol, } #ifdef CONFIG_CIFS_DFS_UPCALL +static inline void set_root_tcon(struct cifs_sb_info *cifs_sb, + struct cifs_tcon *tcon, + struct cifs_tcon **root) +{ + spin_lock(&cifs_tcp_ses_lock); + tcon->tc_count++; + tcon->remap = cifs_remap(cifs_sb); + spin_unlock(&cifs_tcp_ses_lock); + *root = tcon; +} + int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol) { int rc = 0; @@ -4887,18 +4898,10 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol) /* Cache out resolved root server */ (void)dfs_cache_find(xid, ses, cifs_sb->local_nls, cifs_remap(cifs_sb), root_path + 1, NULL, NULL); - /* - * Save root tcon for additional DFS requests to update or create a new - * DFS cache entry, or even perform DFS failover. - */ - spin_lock(&cifs_tcp_ses_lock); - tcon->tc_count++; - tcon->dfs_path = root_path; + kfree(root_path); root_path = NULL; - tcon->remap = cifs_remap(cifs_sb); - spin_unlock(&cifs_tcp_ses_lock); - root_tcon = tcon; + set_root_tcon(cifs_sb, tcon, &root_tcon); for (count = 1; ;) { if (!rc && tcon) { @@ -4935,6 +4938,15 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol) mount_put_conns(cifs_sb, xid, server, ses, tcon); rc = mount_get_conns(vol, cifs_sb, &xid, &server, &ses, &tcon); + /* + * Ensure that DFS referrals go through new root server. + */ + if (!rc && tcon && + (tcon->share_flags & (SHI1005_FLAGS_DFS | + SHI1005_FLAGS_DFS_ROOT))) { + cifs_put_tcon(root_tcon); + set_root_tcon(cifs_sb, tcon, &root_tcon); + } } if (rc) { if (rc == -EACCES || rc == -EOPNOTSUPP)