Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp205563imj; Thu, 14 Feb 2019 18:39:50 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia3hKbZLnQsPhUCjKzs3J+fCSlNiebvdQZWHR3J4vKxW4HFYiWhbKETR3GGiRjBpYVIyEY/ X-Received: by 2002:a62:e216:: with SMTP id a22mr7435469pfi.20.1550198390831; Thu, 14 Feb 2019 18:39:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198390; cv=none; d=google.com; s=arc-20160816; b=Kbf1+JgiJ1+LGtKQTTV1cKX+rmE3FIxz3943ng4JZm/0CtglxythTVvT1OrQ98H4ps FUeJnL0NEpwAmsyVq3er+CyeitlxXtnou+/uyb+noqwMcNLagUL0tjHtR9QuD3sEAOmR 3cHZztE88OB3RiAokBwp4e9HHTxrhsAk72xVcJP8rrmspBgPrpEZDA+tTY/qjb++aPsW ASvKuj8VOezwMAYEYEzEdPBHzl9oYE7gKyz6qGcALLUc/VUSLGwjgKfURXOG4Gg2+wPy FEQlIfhJvWx7Y1doDCUplk84n7YfM004uYY8Tzn/GJDvt31nQvESZtJlIE/kB+MsoFFf kk1Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=apeGwlKzqnNHMWHZsIIAMnGs39HE+u6WJMQFkXlqqwY=; b=0UuSp3vCktjYcifSc6SH1YFP1XPQZ+Un63S737Ix2qjAt4CGnCo12ZkdxB4cRp8mSa YKbrxxwd1L7qW/LvNlbhEbJd+U3jIU2rTDVClEOaxKNbPAHaHu7h8XxM5BlGPdxhFV0d pFbITcPsxw5ASZRzlkNXkqf9t2sl4dYtBb9D//GV4+6JcWo936TlYyg3lW4PSkdcQMcB kJ3d0muUXcnzf/X2LJJRZPppXCVW/LWzPtHGVUqRIE5L+xiTvX1OvgbNKJh4022sX6iH o7K9NTnFdallB7nYfTkLJKLbV5STlUBJCnt2H0nFPoKSRV8mX+h2+NhLjf2mRrgEACsm a4KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=crQpU7yw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4si4078503pgc.186.2019.02.14.18.39.34; Thu, 14 Feb 2019 18:39:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=crQpU7yw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732005AbfBOCK6 (ORCPT + 99 others); Thu, 14 Feb 2019 21:10:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:51012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731951AbfBOCKx (ORCPT ); Thu, 14 Feb 2019 21:10:53 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 546AA222A1; Fri, 15 Feb 2019 02:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196653; bh=YizPXQ9O2g4UGq3v7B2rEW7KqMxKK/TFvRQi63R+Jzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=crQpU7ywiPa9JcRXTJNO4/QWIHsHi8kuPyo+Ksf1LEGMU56Srue0Ey/vLkwqRlyX8 B2zg0xgBNtU+t0cLZNoEitwjQ5ZDEoqSkV+SDK26sq8OqZN8BkVocUjAB948BWuZSl IlE68J076tIRHwPQicnKO+JNALdV2x8x/VGcgbDg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Pavel Shilovsky , Steve French , Sasha Levin , linux-cifs@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 66/77] CIFS: Fix mounts if the client is low on credits Date: Thu, 14 Feb 2019 21:08:44 -0500 Message-Id: <20190215020855.176727-66-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Shilovsky [ Upstream commit 6a9cbdd1ceca1dc2359ddf082efe61b97c3e752b ] If the server doesn't grant us at least 3 credits during the mount we won't be able to complete it because query path info operation requires 3 credits. Use the cached file handle if possible to allow the mount to succeed. Signed-off-by: Pavel Shilovsky Reviewed-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/smb2inode.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index a8999f930b22..057d2034209f 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c @@ -294,6 +294,8 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, int rc; struct smb2_file_all_info *smb2_data; __u32 create_options = 0; + struct cifs_fid fid; + bool no_cached_open = tcon->nohandlecache; *adjust_tz = false; *symlink = false; @@ -302,6 +304,21 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, GFP_KERNEL); if (smb2_data == NULL) return -ENOMEM; + + /* If it is a root and its handle is cached then use it */ + if (!strlen(full_path) && !no_cached_open) { + rc = open_shroot(xid, tcon, &fid); + if (rc) + goto out; + rc = SMB2_query_info(xid, tcon, fid.persistent_fid, + fid.volatile_fid, smb2_data); + close_shroot(&tcon->crfid); + if (rc) + goto out; + move_smb2_info_to_cifs(data, smb2_data); + goto out; + } + if (backup_cred(cifs_sb)) create_options |= CREATE_OPEN_BACKUP_INTENT; -- 2.19.1