Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp25627ybp; Thu, 3 Oct 2019 09:40:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbg87/Z0joCzRdOZzhLmTdikrza62K7JQ39VHuRWWas3JAk7huNnxJ6EEV1rxzsEBtrlrH X-Received: by 2002:a17:906:5382:: with SMTP id g2mr8478110ejo.203.1570120846434; Thu, 03 Oct 2019 09:40:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570120846; cv=none; d=google.com; s=arc-20160816; b=fNYT11fSyNpxj3NtZnZaXvYeybkdi3rWI5r/zyREgyx8iyfbzwph4xQF+u4TxFgrhV /jKJOFnQHsAmwliomiV32KyuYeA2se9l156tQz/Vx6bDfDXPG9VaKwu8FB66SmtlkEVy P/SuZdfP2MOMINJFS43S0pKRxkHumKCvnqUDxnGLcplu9P3ikUPBThNhhpCYvzjDuoz3 uqgJEduq8ILWjRcLBY5sZw+YcCpnGWCX35LidQSRahwlZiwRWY6bkEGxh0P77ikELV4H DiwstzXUZ/FqVqWfv9ZwwNuSgQ1T4IGxpg7H6w0Q4FCAp3fv6/4Xh9VymYhjAWDMItcs F67w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c3g5HTWulXrt0gZjiXPgWkWQ5COkPNEETmDqoMqpAC4=; b=sqcggVoHkuedydwjzXQUG73zMEaWcX9tcFdVeayVUCEfXsQmN9CE5ZaPs5KnT2mX51 HRy8m/dagxmtqi7y1bAeoOX5IqGxeC58kwYGXWVpzUBMz7eLkj//DC96qjmGgoWt1kEm SDaEmS21ZG3THkcfnugo+LwljE3YcmEzJF+U60kvrSHehDNxehfK7yEDWZ54bQevVuYi 56d4rtbiHxWYD9wrAaWqjweBWqochmJZrnl0W5nklIauKo9P9dKtKwodS4C2jDxx8Fwq n+1RNSoJL3bqwS38h8nfSq1hbVDJYAOhxPYTTrW7CFDGhB4JSV8FTQ4QjJbO56YTwNl1 MgwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IeuQboi9; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p14si1826603edc.227.2019.10.03.09.40.22; Thu, 03 Oct 2019 09:40:46 -0700 (PDT) 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=IeuQboi9; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404450AbfJCQgi (ORCPT + 99 others); Thu, 3 Oct 2019 12:36:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:45810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404421AbfJCQgc (ORCPT ); Thu, 3 Oct 2019 12:36:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 515E420830; Thu, 3 Oct 2019 16:36:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120591; bh=LqUUEeoKYvkkjTMu9gUBe9IHfdDmeTnpBYJ6rUhGGkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IeuQboi9JYOO/ZyJWpmdoiJmqke/LwmYfTg/oKqXv3IELSuifOJaCAwLpkqu0kqKd AE6IK8v/XwxWcmekLyj3uSXfUCBINm5qvDQ3CurbvoMXKhZXxsyt427Fo+7snSxxbR ou05MyvOI7ygpC7MHcfz3xEFIXOvrT+vGaU0le74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Shilovsky , Steve French , Ronnie Sahlberg Subject: [PATCH 5.2 278/313] smb3: allow disabling requesting leases Date: Thu, 3 Oct 2019 17:54:16 +0200 Message-Id: <20191003154600.435971176@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steve French commit 3e7a02d47872081f4b6234a9f72500f1d10f060c upstream. In some cases to work around server bugs or performance problems it can be helpful to be able to disable requesting SMB2.1/SMB3 leases on a particular mount (not to all servers and all shares we are mounted to). Add new mount parm "nolease" which turns off requesting leases on directory or file opens. Currently the only way to disable leases is globally through a module load parameter. This is more granular. Suggested-by: Pavel Shilovsky Signed-off-by: Steve French Reviewed-by: Ronnie Sahlberg Reviewed-by: Pavel Shilovsky CC: Stable Signed-off-by: Greg Kroah-Hartman --- fs/cifs/cifsfs.c | 2 ++ fs/cifs/cifsglob.h | 2 ++ fs/cifs/connect.c | 9 ++++++++- fs/cifs/smb2pdu.c | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -433,6 +433,8 @@ cifs_show_options(struct seq_file *s, st cifs_show_security(s, tcon->ses); cifs_show_cache_flavor(s, cifs_sb); + if (tcon->no_lease) + seq_puts(s, ",nolease"); if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER) seq_puts(s, ",multiuser"); else if (tcon->ses->user_name) --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -575,6 +575,7 @@ struct smb_vol { bool noblocksnd:1; bool noautotune:1; bool nostrictsync:1; /* do not force expensive SMBflush on every sync */ + bool no_lease:1; /* disable requesting leases */ bool fsc:1; /* enable fscache */ bool mfsymlinks:1; /* use Minshall+French Symlinks */ bool multiuser:1; @@ -1079,6 +1080,7 @@ struct cifs_tcon { bool need_reopen_files:1; /* need to reopen tcon file handles */ bool use_resilient:1; /* use resilient instead of durable handles */ bool use_persistent:1; /* use persistent instead of durable handles */ + bool no_lease:1; /* Do not request leases on files or directories */ __le32 capabilities; __u32 share_flags; __u32 maximal_access; --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -74,7 +74,7 @@ enum { Opt_user_xattr, Opt_nouser_xattr, Opt_forceuid, Opt_noforceuid, Opt_forcegid, Opt_noforcegid, - Opt_noblocksend, Opt_noautotune, + Opt_noblocksend, Opt_noautotune, Opt_nolease, Opt_hard, Opt_soft, Opt_perm, Opt_noperm, Opt_mapposix, Opt_nomapposix, Opt_mapchars, Opt_nomapchars, Opt_sfu, @@ -133,6 +133,7 @@ static const match_table_t cifs_mount_op { Opt_noforcegid, "noforcegid" }, { Opt_noblocksend, "noblocksend" }, { Opt_noautotune, "noautotune" }, + { Opt_nolease, "nolease" }, { Opt_hard, "hard" }, { Opt_soft, "soft" }, { Opt_perm, "perm" }, @@ -1709,6 +1710,9 @@ cifs_parse_mount_options(const char *mou case Opt_noautotune: vol->noautotune = 1; break; + case Opt_nolease: + vol->no_lease = 1; + break; case Opt_hard: vol->retry = 1; break; @@ -3230,6 +3234,8 @@ static int match_tcon(struct cifs_tcon * return 0; if (tcon->handle_timeout != volume_info->handle_timeout) return 0; + if (tcon->no_lease != volume_info->no_lease) + return 0; return 1; } @@ -3444,6 +3450,7 @@ cifs_get_tcon(struct cifs_ses *ses, stru tcon->nocase = volume_info->nocase; tcon->nohandlecache = volume_info->nohandlecache; tcon->local_lease = volume_info->local_lease; + tcon->no_lease = volume_info->no_lease; INIT_LIST_HEAD(&tcon->pending_opens); spin_lock(&cifs_tcp_ses_lock); --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2370,7 +2370,7 @@ SMB2_open_init(struct cifs_tcon *tcon, s iov[1].iov_len = uni_path_len; iov[1].iov_base = path; - if (!server->oplocks) + if ((!server->oplocks) || (tcon->no_lease)) *oplock = SMB2_OPLOCK_LEVEL_NONE; if (!(server->capabilities & SMB2_GLOBAL_CAP_LEASING) ||