Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp950734pxb; Wed, 6 Apr 2022 05:08:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXUJwKnzap2p4uGMcavIOHBcBYDI+ZHmSTeEQDxkYxrOvTs4EvwsdnHc0D/mY78lPKcZT/ X-Received: by 2002:a63:f201:0:b0:399:2b10:3433 with SMTP id v1-20020a63f201000000b003992b103433mr6648206pgh.285.1649246924316; Wed, 06 Apr 2022 05:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649246924; cv=none; d=google.com; s=arc-20160816; b=tBnS1LR/y3FgWd0aRcaALXgfqxlWqxpd49G4mBAM8BGXli7AYaHKMyXf9SpscYa7Nq JDg6UDiDmQd8+5dCaARD6tp+D77GWT7oJt6E67LS2+pe8XEDlfyblKDgozDf7G+j3Jxt iumOQsN6PiOasruXTfwiqqlnxTteObyY+5zPEe6ZOx8Moml/cpyN+borscw6Z1fg0mlf FXuEOgT/1uodVBlkPnZxG+szQNq3mDNY25FYwLEjOgj4UzNToNYhZSCr6L/vMSzGJHvu eoOKNZ7Mh2f/2GQKjV6fMWk6YaohAifsVwUWP1+jJMNlRk5xbdBiI8JfxbasssbszcfZ btDw== 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=Z1DpZbtK0tSNZZ/Al0PzxeNnViwW17hhgPAhehXM73I=; b=NLv6DXOSI52fJOQ/tgf7rKxZq2Gj1/WtgXYO5QpxFvCm0FFahykFcNL2qPF2O5MR+C DUs2V7ejKz8feNCIX6ecBxFVAUAafQqrnR+CwnXnSVMt+NMsOVZr0Pj3C09TajkKv2uC 7+wOp1jkrW+ENufR18QfagDLTz1ChbSGWu5Y9MqrZHbbagBd/caFNWTClz8XCqjJvyuk Gs3SqIcqT5glo50IUgNVN+DaN+OMdrHIenYDVIulp6V51pnGg0HCJI5lgSyKl6beNSLy 0SQlk++N1k7Hlzo4j8BzF6rSIYDT+2gQCcbplmNnWbQetGyRbPiJIp/qIKghZqQe+cBF Tr/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PbZEKi0m; 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 u30-20020a056a00099e00b004fa3a8dffa5si16959915pfg.92.2022.04.06.05.08.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:08: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=PbZEKi0m; 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 C2AB34F9627; Wed, 6 Apr 2022 03:40:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241621AbiDEVHl (ORCPT + 99 others); Tue, 5 Apr 2022 17:07:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351231AbiDEKBr (ORCPT ); Tue, 5 Apr 2022 06:01:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C79156C955; Tue, 5 Apr 2022 02:51:32 -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 ams.source.kernel.org (Postfix) with ESMTPS id 626A2B81B14; Tue, 5 Apr 2022 09:51:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7C20C385A1; Tue, 5 Apr 2022 09:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152290; bh=D7L0OFuGq8ZDjoEuhEiuaTbdXnNi98bio94Ocv4+WzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PbZEKi0mgr5KqKeybjCaRIjFeZb6dUDihhUaTVKaAlQBrwzQxOZI2+GccCQBT94yc xYXgYCaihph74zDldmFmuKZHZHpK2GRWYuxLw0DqZ2n8Qi53gUM7Z7ZoOIbAbgpkFe R6yNyLzsFR29DvhVg1ycAuLpUwA7+fAokLft3Uo4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rohith Surabattula , "Paulo Alcantara (SUSE)" , Steve French , Sasha Levin Subject: [PATCH 5.15 723/913] Adjust cifssb maximum read size Date: Tue, 5 Apr 2022 09:29:45 +0200 Message-Id: <20220405070401.504022314@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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: Rohith Surabattula [ Upstream commit 06a466565d54a1a42168f9033a062a3f5c40e73b ] When session gets reconnected during mount then read size in super block fs context gets set to zero and after negotiate, rsize is not modified which results in incorrect read with requested bytes as zero. Fixes intermittent failure of xfstest generic/240 Note that stable requires a different version of this patch which will be sent to the stable mailing list. Signed-off-by: Rohith Surabattula Acked-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/cifsfs.c | 3 +++ fs/cifs/file.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 22a1d8156220..ed220daca3e1 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -210,6 +210,9 @@ cifs_read_super(struct super_block *sb) if (rc) goto out_no_root; /* tune readahead according to rsize if readahead size not set on mount */ + if (cifs_sb->ctx->rsize == 0) + cifs_sb->ctx->rsize = + tcon->ses->server->ops->negotiate_rsize(tcon, cifs_sb->ctx); if (cifs_sb->ctx->rasize) sb->s_bdi->ra_pages = cifs_sb->ctx->rasize / PAGE_SIZE; else diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 82bbaf8e92b7..b23f6b489bb9 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3734,6 +3734,11 @@ cifs_send_async_read(loff_t offset, size_t len, struct cifsFileInfo *open_file, break; } + if (cifs_sb->ctx->rsize == 0) + cifs_sb->ctx->rsize = + server->ops->negotiate_rsize(tlink_tcon(open_file->tlink), + cifs_sb->ctx); + rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize, &rsize, credits); if (rc) @@ -4512,6 +4517,11 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, break; } + if (cifs_sb->ctx->rsize == 0) + cifs_sb->ctx->rsize = + server->ops->negotiate_rsize(tlink_tcon(open_file->tlink), + cifs_sb->ctx); + rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize, &rsize, credits); if (rc) -- 2.34.1