Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp910411pxb; Wed, 6 Apr 2022 04:02:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2ozxuek2D+aeTV/haUKhPQf44sLbShvomlKS6Tf4+0LmdKzXqnihDhyORbLP89CdX74eN X-Received: by 2002:a63:8443:0:b0:398:6e02:49e7 with SMTP id k64-20020a638443000000b003986e0249e7mr6598065pgd.145.1649242964274; Wed, 06 Apr 2022 04:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649242964; cv=none; d=google.com; s=arc-20160816; b=sbV4JPvp15IwSQzzM0z0NCFS1kcJIXi8E4+jNWisMte7vIl7XFHTWsPFrfqcRBH4YM tDfXuplbGGoU1sxEKhRUR3I1YfgungT8kndekW9yFgYOkj5xY1rWmIJtDyx/mBveDkqn Lx+y36Aut5jawo6GCP5AxajOVm/s9VP12B9xaAU1w5C9osSVIIy/8QzY3UV/QFbFHdb9 1iFUWYmi36tvoiWtfjXGS5eJlMRz+ORL1wobJ/Cz0EfYm8jdjMHPvNajJb5xMvxJysga WNls3Rz1WYKPGurqxL5CME1QY0Jw6HD61UJhbba/ehr5hOhvhdfWIMI4bcDJyp+1eIZI ckFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XJISY1GDHED+sd4AR6EpgfKji04cOPBHdPI9cUHoCRY=; b=zqW73p/X4E0/cb+zeEtuUIr5TfKShWVLLpvEI/io9pBCA7pBqvx9loJcKX9LncTv9F MV2gZfbKJXKI3lGrVBhcm96VrF9bKwUouInbMLu3cBIfg9be4MLbdJjigbPfF+ZPr+Sx hVytDtGtAMVVYcjffqCatTX9dqYqgnFHPow8OYOLDpqOPSIZBaZYZ73crapdf1AfitqO Kd6oMj9oa9VkM0k0qp/v2mXSYk6KrWLFSzlcl24H23SdifJxVn2HyuDICEuKdFIg/weU PhW3eMiSpS/on+2k8wIFvp3YFvWHG6IPAbonXL1sVWA3zt6njzpZ2D/SM7fEo5KwUUQg xNng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kNu6dePr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pi19-20020a17090b1e5300b001c6deb4730asi4638454pjb.109.2022.04.06.04.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:02:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kNu6dePr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 379A85B75F4; Wed, 6 Apr 2022 02:25:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234211AbiDEH6E (ORCPT + 99 others); Tue, 5 Apr 2022 03:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232726AbiDEHrG (ORCPT ); Tue, 5 Apr 2022 03:47:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFC6B9AE42; Tue, 5 Apr 2022 00:42:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2FF99616D9; Tue, 5 Apr 2022 07:42:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43660C340EE; Tue, 5 Apr 2022 07:42:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649144573; bh=tWANHQHbcE1gOVX+QGv3inRTJJbYxPoiShgmtCsrN2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kNu6dePrrUzsfg8wbgtw6nc9P+Wab3aBGWVOPi3qMxAw10HL21sB//fUhDGbpGN7u XJqZcA1glA2LhoGBd8mFu0tWStQht6Wn0uVRC3zlDbSZraoaeiF3yK2CnJ9b1UMVwU UI1+8OIeUJllwU+lykkvsClOmKRbU1nCnFNAPdAE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Steve French Subject: [PATCH 5.17 0092/1126] cifs: do not skip link targets when an I/O fails Date: Tue, 5 Apr 2022 09:13:59 +0200 Message-Id: <20220405070410.268808231@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paulo Alcantara commit 5d7e282541fc91b831a5c4477c5d72881c623df9 upstream. When I/O fails in one of the currently connected DFS targets, retry it from other targets as specified in MS-DFSC "3.1.5.2 I/O Operation to +Target Fails with an Error Other Than STATUS_PATH_NOT_COVERED." Signed-off-by: Paulo Alcantara (SUSE) Cc: stable@vger.kernel.org Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/connect.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3473,6 +3473,9 @@ static int connect_dfs_target(struct mou struct cifs_sb_info *cifs_sb = mnt_ctx->cifs_sb; char *oldmnt = cifs_sb->ctx->mount_options; + cifs_dbg(FYI, "%s: full_path=%s ref_path=%s target=%s\n", __func__, full_path, ref_path, + dfs_cache_get_tgt_name(tit)); + rc = dfs_cache_get_tgt_referral(ref_path, tit, &ref); if (rc) goto out; @@ -3571,13 +3574,18 @@ static int __follow_dfs_link(struct moun if (rc) goto out; - /* Try all dfs link targets */ + /* Try all dfs link targets. If an I/O fails from currently connected DFS target with an + * error other than STATUS_PATH_NOT_COVERED (-EREMOTE), then retry it from other targets as + * specified in MS-DFSC "3.1.5.2 I/O Operation to Target Fails with an Error Other Than + * STATUS_PATH_NOT_COVERED." + */ for (rc = -ENOENT, tit = dfs_cache_get_tgt_iterator(&tl); tit; tit = dfs_cache_get_next_tgt(&tl, tit)) { rc = connect_dfs_target(mnt_ctx, full_path, mnt_ctx->leaf_fullpath + 1, tit); if (!rc) { rc = is_path_remote(mnt_ctx); - break; + if (!rc || rc == -EREMOTE) + break; } } @@ -3651,7 +3659,7 @@ int cifs_mount(struct cifs_sb_info *cifs goto error; rc = is_path_remote(&mnt_ctx); - if (rc == -EREMOTE) + if (rc) rc = follow_dfs_link(&mnt_ctx); if (rc) goto error;