From patchwork Wed Jan 23 21:10:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 10777891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 72E236C2 for ; Wed, 23 Jan 2019 21:11:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62A4D2D7AB for ; Wed, 23 Jan 2019 21:11:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 567672D7B2; Wed, 23 Jan 2019 21:11:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0669A2D7AB for ; Wed, 23 Jan 2019 21:11:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726792AbfAWVLB (ORCPT ); Wed, 23 Jan 2019 16:11:01 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39603 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbfAWVLB (ORCPT ); Wed, 23 Jan 2019 16:11:01 -0500 Received: by mail-pg1-f195.google.com with SMTP id w6so1629537pgl.6 for ; Wed, 23 Jan 2019 13:11:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=uljiIcXzFMftdJgS1nPeUniSy11Z7HlPRtcmVgLvUhc=; b=qSACM+U6FZGgugjsa36kejI4RJfN9/U7qB52ZdpkvP+zp4WKKuK0Tugl62GWK0116S 6MCgc3nn7js/y8FlJzFQFslP1ca5w0Dz7J+CfLNbhpKf1IIcOa79JW2iVe/fpoSkzGiV YHHGgt2MiRMtdDu8IwW8p7Fx+V04k0M5kUz1uWjFpGBL4VvIUeBlZNjHILUozWOWEXbV +yKfK1LaU3Qi0smZs7A8n4RxEKQdodz1EPWxECYF6VB+kkE0v46QvKh5HI4m+2sN8Akl EnPJ8/SAg47g7SsHQJz2okwj/duSsOo/hGhFxB/j01u0WnNcGdgi5ZnNXMz1OxPulNzG BUHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=uljiIcXzFMftdJgS1nPeUniSy11Z7HlPRtcmVgLvUhc=; b=kenvcbj7/Z7Ywf6aJRgcXc/C9vnV3CDF0CvhKgTuke3/Z82keu6rdCZY0fLopWD1tF qMJQ432oIJo7OzphUibZrRGxkLSwj1CvnMHvBkYHT8Ns/X0QKUec1eZ03YXOztxmH44u Y9HQVlOLhwdjbCi6PrMIeF8DYZxXYDcXoIw6VK5VP6VjRW+I6iEgDAt0x7evPdIjkISF gTqSeKMU48G1C4rmOw8kZm0reD7LH8cfiq+BrHdlSW4Cr4pnkcVktyBri50njmtQ6LQ7 RX/Da0pBVXuHe0uWfktLxRuzPnwl2PIX+s4SVT/q0gX/PyOPjJYgN5KF0kgt8ooDM9SU Qr6w== X-Gm-Message-State: AJcUukcDaWCWoWIhQxvrU+h5M/GODf4Pvatxh+dZxxLDYA6Gg/E4TgSS TaxuPlXfjyUMpbjUMiWtqPSAHGo= X-Google-Smtp-Source: ALg8bN6GNtQmd9eNoOgdnX+HZ67Bbbifsqx1MMvA+bgZ600LlwXe3g/Rrk8sxIqyZw2lOWu1Jp+GnA== X-Received: by 2002:a62:546:: with SMTP id 67mr3552304pff.99.1548277860035; Wed, 23 Jan 2019 13:11:00 -0800 (PST) Received: from ubuntu-vm.corp.microsoft.com ([2001:4898:80e8:f:a17f:4e9f:6b7c:507d]) by smtp.gmail.com with ESMTPSA id n73sm28063714pfj.148.2019.01.23.13.10.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Jan 2019 13:10:58 -0800 (PST) From: Pavel Shilovsky X-Google-Original-From: Pavel Shilovsky To: linux-cifs@vger.kernel.org, Steve French , Ronnie Sahlberg Subject: [PATCH 06/15] CIFS: Fix mounts if the client is low on credits Date: Wed, 23 Jan 2019 13:10:36 -0800 Message-Id: <1548277845-6746-7-git-send-email-pshilov@microsoft.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548277845-6746-1-git-send-email-pshilov@microsoft.com> References: <1548277845-6746-1-git-send-email-pshilov@microsoft.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- fs/cifs/smb2inode.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index a8999f9..057d203 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;