From patchwork Wed Oct 21 05:25:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 11848295 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=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 A7118C5517A for ; Wed, 21 Oct 2020 05:26:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 27F0A21D7B for ; Wed, 21 Oct 2020 05:26:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BhaHsBSi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407638AbgJUF0J (ORCPT ); Wed, 21 Oct 2020 01:26:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407533AbgJUF0J (ORCPT ); Wed, 21 Oct 2020 01:26:09 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45E06C0613CE for ; Tue, 20 Oct 2020 22:26:09 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id p15so1121736ljj.8 for ; Tue, 20 Oct 2020 22:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=hptYP+sgbBe/kJvWIw/N36ee72twdhgshClkTUCB3Xc=; b=BhaHsBSiIX55IVo0pXbjkOKNFp+dCMxlE+qRmYIwVgY56Wvvmh3GgmhJD8rGJMnm7m ooaPDhpAI3p4XfzudwIZ9AIuqYVVpjO0aUyB1EGoI2BNNN+Cx53XbI4zbMbxLmeu/f2p tJEgKlW9yPzbiAZqIjHUxaBkrgEpnODQUrrdY7qdwcfj7UnSYs9nAjFB2asYmcOktX6L mXbVvRL5jPEqL9ddWBQXKFYRZ28HgxPCroKOmJWgL5G3Sz791zkZP2HAIt/MYdfaRD2S RBaIAWZRc76GyT+zoSR/sXmoovaxP07sQu8hQ8E+MHmDInIyhqr2d+Xhh0u8AT7GZQy0 njWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=hptYP+sgbBe/kJvWIw/N36ee72twdhgshClkTUCB3Xc=; b=QBamgSC5YGcqL177XMq384ufZkiMTu5dk5XZXeSDPO1UX8/BM8Kgiq1nUvcD8MSKxG 464LJ9VdLuT8tjYu3i/j8juiyVq4I3LRQzAE3iLR5jWLe6rRVPOgG5w8F1LalhZs7NV5 9OCwW79XwvdUCGI+DDX0YNb9LCJb6Ay11YYkMG77no8ncpOn2el8hPYdkHa6Nodo8jEK s4gtcu7E9KH3tIf4EIAc5VRNALs5lBFEYNCOEvydTfr3szwFPogg8YMpxSw6B5UYT6rX YNExmci82Dk0flO5sIxnA1RMdNvFU9cG1ZfQZitpaTHqo65jZGEtblJoSCtNgF+HpdGH GA2A== X-Gm-Message-State: AOAM533qgKTNnsrEANWnRcJOk81vyETdIVk5H4xVWw3W8SMJm6c9Uxsn yjX50fTyikG8xMno4UFgrZvq1AP9HApekbllGYQXn3jjYG8m4A== X-Google-Smtp-Source: ABdhPJzOIo/1n4B501CEhPADxNRwE+tON6bO4ISYgGZSw90ufeefLXNEhJFYHJI0PDQoaCDHGDb8pq4KxUVUMEodE+w= X-Received: by 2002:a2e:b009:: with SMTP id y9mr556585ljk.372.1603257967552; Tue, 20 Oct 2020 22:26:07 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Wed, 21 Oct 2020 00:25:56 -0500 Message-ID: Subject: [PATCH][SMB3] do not try to cache root directory if dir leases not supported To: CIFS Cc: samba-technical Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org To servers which do not support directory leases (e.g. Samba) it is wasteful to try to open_shroot (ie attempt to cache the root directory handle). Skip attempt to open_shroot when server does not indicate support for directory leases. Cuts the number of requests on mount from 17 to 15, and cuts the number of requests on stat of the root directory from 4 to 3. (also added cc: stable v5.1+) From b640e377cd8276a2f7406a6b473ba19f98a31fed Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 21 Oct 2020 00:15:42 -0500 Subject: [PATCH] smb3: do not try to cache root directory if dir leases not supported To servers which do not support directory leases (e.g. Samba) it is wasteful to try to open_shroot (ie attempt to cache the root directory handle). Skip attempt to open_shroot when server does not indicate support for directory leases. Cuts the number of requests on mount from 17 to 15, and cuts the number of requests on stat of the root directory from 4 to 3. Signed-off-by: Steve French CC: Stable # v5.1+ --- fs/cifs/connect.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index b4282abc3d12..bcb539c22e39 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3608,7 +3608,10 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) */ tcon->retry = volume_info->retry; tcon->nocase = volume_info->nocase; - tcon->nohandlecache = volume_info->nohandlecache; + if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING) + tcon->nohandlecache = volume_info->nohandlecache; + else + tcon->nohandlecache = 1; tcon->nodelete = volume_info->nodelete; tcon->local_lease = volume_info->local_lease; INIT_LIST_HEAD(&tcon->pending_opens); -- 2.25.1