]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
smb3: do not try to cache root directory if dir leases not supported
authorSteve French <stfrench@microsoft.com>
Wed, 21 Oct 2020 05:15:42 +0000 (00:15 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:10:57 +0000 (10:10 +0100)
commit 3c6e65e679182d55779ef6f8582f0945af4319b0 upstream.

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 <stfrench@microsoft.com>
CC: Stable <stable@vger.kernel.org> # v5.1+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/connect.c

index a5731dd6e6566e7f86bac2db176f3c640a4d266f..9817a31a39db6ff1dbea5b912280490685f438f9 100644 (file)
@@ -3595,7 +3595,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);