From nobody Sat Nov 30 04:26:07 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E58AD1BAEF8 for ; Wed, 11 Sep 2024 19:43:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726083801; cv=none; b=lQo1a28izLy15/m8jbm7DcBh4P3YjyPks+F45Qe3K+pvjI4pB9wvJBWoJI0Sdpqzgp0v77GOUtE9pBjMzlRWYKbSbdLPRL5MrP+/0UeMoiX7e/nT8cCOH5squKcL8ywkAUcS2z9MBfTXUM3HUt5FJpF6JtcEC75QaGuMAOLrjnk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726083801; c=relaxed/simple; bh=JBs0Crisuw7Mx/HDlXn/qHrSZEkKs6TKeOaWubkYBpg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kDPwwvoIp/08tUvx4vY3PZajK/VKypvlb7yhT2QdcKvlN+ssbgLX23yC6uVprgwhVmMHQHE7QuDA+tPSWpl5vaSUDpeB1wt4HNBR0Dx63paWhQWPhLEZwIixR//fkdlNYz3h+axIkszR9hrLbEWsBn3tTE66jCzFadQ4WIpsMe4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Kejn6mRh; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Kejn6mRh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726083798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yWxsTklmkJjx+Rd0gmMs3KD/KNm3/BpXnllaXcqeyr0=; b=Kejn6mRhC/jZdqv3ueDwArfeUB6LzkIIJMUaz71F/ZbhdqWN4sP+Xo50sJ87z8avbBRXTJ K2eu1nDudFPBQCEpygkaelewa00mKLvWfgKkR7p4g6W04qA7fTlGlTcqG25NPi7FilMLby uLCxPqK392kZDbqhtH8F3Tp70AB0yts= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-164-Z7upLKxzOmitg9rb7MQx_A-1; Wed, 11 Sep 2024 15:43:15 -0400 X-MC-Unique: Z7upLKxzOmitg9rb7MQx_A-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BD3981955F42; Wed, 11 Sep 2024 19:43:12 +0000 (UTC) Received: from bcodding.csb.redhat.com (unknown [10.22.48.7]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 93A8B1956088; Wed, 11 Sep 2024 19:43:07 +0000 (UTC) From: Benjamin Coddington To: Chuck Lever , Jeff Layton , Amir Goldstein , Neil Brown , Trond Myklebust , Anna Schumaker , Jonathan Corbet , Andreas Gruenbacher , Mark Fasheh , Joel Becker , Joseph Qi , Alexander Viro , Christian Brauner , Jan Kara , Alexander Ahring Oder Aring Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, gfs2@lists.linux.dev, ocfs2-devel@lists.linux.dev Subject: [PATCH v1 1/4] fs: Introduce FOP_ASYNC_LOCK Date: Wed, 11 Sep 2024 15:42:57 -0400 Message-ID: <3330d5a324abe2ce9c1dafe89cacdc6db41945d1.1726083391.git.bcodding@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" Some lock managers (NLM, kNFSD) fastidiously avoid blocking their kernel threads while servicing blocking locks. If a filesystem supports asynchronous lock requests those lock managers can use notifications to quickly inform clients they have acquired a file lock. Historically, only posix_lock_file() was capable of supporting asynchronous locks so the check for support was simply file_operations->lock(), but with recent changes in DLM, both GFS2 and OCFS2 also support asynchronous locks and have started signalling their support with EXPORT_OP_ASYNC_LOCK. We recently noticed that those changes dropped the checks for whether a filesystem simply defaults to posix_lock_file(), so async lock notifications have not been attempted for NLM and NFSv4.1+ for most filesystems. While trying to fix this it has become clear that testing both the export flag combined with testing ->lock() creates quite a layering mess. It seems appropriate to signal support with a fop_flag. Add FOP_ASYNC_LOCK so that filesystems with ->lock() can signal their capability to handle lock requests asynchronously. Add a helper for lock managers to properly test that support. Signed-off-by: Benjamin Coddington Acked-by: Chuck Lever > Reviewed-by: Jeff Layton --- include/linux/filelock.h | 5 +++++ include/linux/fs.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/include/linux/filelock.h b/include/linux/filelock.h index daee999d05f3..58c1120a8253 100644 --- a/include/linux/filelock.h +++ b/include/linux/filelock.h @@ -180,6 +180,11 @@ static inline void locks_wake_up(struct file_lock *fl) wake_up(&fl->c.flc_wait); } =20 +static inline bool locks_can_async_lock(const struct file_operations *fops) +{ + return !fops->lock || fops->fop_flags & FOP_ASYNC_LOCK; +} + /* fs/locks.c */ void locks_free_lock_context(struct inode *inode); void locks_free_lock(struct file_lock *fl); diff --git a/include/linux/fs.h b/include/linux/fs.h index 6ca11e241a24..78221ae589d9 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2074,6 +2074,8 @@ struct file_operations { #define FOP_DIO_PARALLEL_WRITE ((__force fop_flags_t)(1 << 3)) /* Contains huge pages */ #define FOP_HUGE_PAGES ((__force fop_flags_t)(1 << 4)) +/* Supports asynchronous lock callbacks */ +#define FOP_ASYNC_LOCK ((__force fop_flags_t)(1 << 5)) =20 /* Wrap a directory iterator that needs exclusive inode access */ int wrap_directory_iterator(struct file *, struct dir_context *, --=20 2.44.0 From nobody Sat Nov 30 04:26:07 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64DA21BB69D for ; Wed, 11 Sep 2024 19:43:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726083805; cv=none; b=fTbidp4nIKNdHvIy+X05eKc+BHM6QidL2sngMZ0hckwcNJhGzpwWkwr3P4EqnNAslowm7qaTLYt8ObuhoKUMdpIGX7RNebfkC0RHi7+kVZCf9QIE/2Me3UHM0DIs59turDkxAVRrFFf/C14rDlI7swHbbkLTVh6s39MrJtjE9JQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726083805; c=relaxed/simple; bh=YX7ObtXJ2YjTVLS7KdkFBLKT+i/Pn28RHIFNRG4BOIc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DF0q2YKDu/q+/BkFUmLA2V3zehlEWNTrabXiPrUooUW6IqxZHAT7NgVEuEXeAoSU+T3myj/yBjhK6hrvLYuo1771gyzbPV+6Ia0usn4F5FAHT1wiBzvbfloOT+s3ucoEm029RAWTXOYJqgJDlXxzcCEL25SV2furXS6cFieJU+Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=aO4ySEt4; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aO4ySEt4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726083803; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bPLgX1Q9d4+4urj+73qqK9akNSzqf2/CnGKfFlJlHGY=; b=aO4ySEt4gpvzcIyzB5pUgVd5lGr84MEML2O2MDBmxTSt4ocZuL8IzvC2PNzryMv4JVCI/y cxqUTNuKYkJpo36ajPKspi1LBvSpzAehr/nwJdVlHFWo4YfJiL2OhzklkMgo1X97jQA5i2 jwJ62QPgXslorVM+ajwMhcy8cc2jJYQ= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-618-PEnLAncROZasySFNq4XPUg-1; Wed, 11 Sep 2024 15:43:20 -0400 X-MC-Unique: PEnLAncROZasySFNq4XPUg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 39A3A19560A2; Wed, 11 Sep 2024 19:43:17 +0000 (UTC) Received: from bcodding.csb.redhat.com (unknown [10.22.48.7]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C53BB1956086; Wed, 11 Sep 2024 19:43:12 +0000 (UTC) From: Benjamin Coddington To: Chuck Lever , Jeff Layton , Amir Goldstein , Neil Brown , Trond Myklebust , Anna Schumaker , Jonathan Corbet , Andreas Gruenbacher , Mark Fasheh , Joel Becker , Joseph Qi , Alexander Viro , Christian Brauner , Jan Kara , Alexander Ahring Oder Aring Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, gfs2@lists.linux.dev, ocfs2-devel@lists.linux.dev Subject: [PATCH v1 2/4] gfs2/ocfs2: set FOP_ASYNC_LOCK Date: Wed, 11 Sep 2024 15:42:58 -0400 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" Both GFS2 and OCFS2 use DLM locking, which will allow async lock requests. Signal this support by setting FOP_ASYNC_LOCK. Signed-off-by: Benjamin Coddington Acked-by: Chuck Lever > Reviewed-by: Jeff Layton --- fs/gfs2/file.c | 2 ++ fs/ocfs2/file.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 08982937b5df..b9ed2602287d 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -1586,6 +1586,7 @@ const struct file_operations gfs2_file_fops =3D { .splice_write =3D gfs2_file_splice_write, .setlease =3D simple_nosetlease, .fallocate =3D gfs2_fallocate, + .fop_flags =3D FOP_ASYNC_LOCK, }; =20 const struct file_operations gfs2_dir_fops =3D { @@ -1598,6 +1599,7 @@ const struct file_operations gfs2_dir_fops =3D { .lock =3D gfs2_lock, .flock =3D gfs2_flock, .llseek =3D default_llseek, + .fop_flags =3D FOP_ASYNC_LOCK, }; =20 #endif /* CONFIG_GFS2_FS_LOCKING_DLM */ diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index ccc57038a977..a642f1adee6a 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -2793,6 +2793,7 @@ const struct file_operations ocfs2_fops =3D { .splice_write =3D iter_file_splice_write, .fallocate =3D ocfs2_fallocate, .remap_file_range =3D ocfs2_remap_file_range, + .fop_flags =3D FOP_ASYNC_LOCK, }; =20 WRAP_DIR_ITER(ocfs2_readdir) // FIXME! @@ -2809,6 +2810,7 @@ const struct file_operations ocfs2_dops =3D { #endif .lock =3D ocfs2_lock, .flock =3D ocfs2_flock, + .fop_flags =3D FOP_ASYNC_LOCK, }; =20 /* --=20 2.44.0 From nobody Sat Nov 30 04:26:07 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BE681BB6A4 for ; Wed, 11 Sep 2024 19:43:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726083810; cv=none; b=KBKGd62Ft6QpBUOYM20gh7JbC7HyQDkBdmhfUNunm2vXoB3sGwf3HctymejuuEmZ+UknxKQpeiMiNpGL/a4z3y82zYbQR21WpqGNRW2MEWYTqi/qvQahnSk+GQEGdX8gLexqx2+IYsbBlmXHeH5qu9iHa8mZzJvjSFDReEE+7Vc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726083810; c=relaxed/simple; bh=b0DIzDjefkkxIZVUa0LCGDeo2ORRu3b4jeXiOOM3Qbo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sAoPTEw+CIK0qTLEN4lqullXrww5iAr7IhqKAosk/vsPPM2t9L3f+r5lkLIjP/M0XVPMOQrezzz7T8T8oT21Cnkik2539CXCer9XEAYYsL5ggBfG+Qtlb6jXVfs5m73hF7fObEfRu5VCJt50bCSWt9T8/3uVc8uaVK8UiClcWXA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LL7sM1tI; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LL7sM1tI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726083807; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U+XcdzScwVO/r6qG4M59lsPhXqd4i/rpYxME40qGAug=; b=LL7sM1tIHpgsgFqvgQh2mvfUIv0Ro9zhqpqiBAaOSOB14U/KrDfJ4qci4oxzFCz8QEvC5z amWDrt5hbP2gE9kRG9ARuM53TBU+qjr7YbsQXr9wT34Lje2N6q9PG9mCoiAhCn7CuRYi75 IZYnNXU9hiuWv2OiwlY3uipT2eWRPes= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-351-HAkiu9dPMEqc1DtdfAwQzA-1; Wed, 11 Sep 2024 15:43:24 -0400 X-MC-Unique: HAkiu9dPMEqc1DtdfAwQzA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EB20C1956083; Wed, 11 Sep 2024 19:43:21 +0000 (UTC) Received: from bcodding.csb.redhat.com (unknown [10.22.48.7]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 27DC81956096; Wed, 11 Sep 2024 19:43:17 +0000 (UTC) From: Benjamin Coddington To: Chuck Lever , Jeff Layton , Amir Goldstein , Neil Brown , Trond Myklebust , Anna Schumaker , Jonathan Corbet , Andreas Gruenbacher , Mark Fasheh , Joel Becker , Joseph Qi , Alexander Viro , Christian Brauner , Jan Kara , Alexander Ahring Oder Aring Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, gfs2@lists.linux.dev, ocfs2-devel@lists.linux.dev Subject: [PATCH v1 3/4] NLM/NFSD: Fix lock notifications for async-capable filesystems Date: Wed, 11 Sep 2024 15:42:59 -0400 Message-ID: <865c40da44af67939e8eb560d17a26c9c50f23e0.1726083391.git.bcodding@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" Instead of checking just the exportfs flag, use the new locks_can_async_lock() helper which allows NLM and NFSD to once again support lock notifications for all filesystems which use posix_lock_file(). Signed-off-by: Benjamin Coddington Acked-by: Chuck Lever > Reviewed-by: Jeff Layton --- fs/lockd/svclock.c | 5 ++--- fs/nfsd/nfs4state.c | 19 ++++--------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 1f2149db10f2..cbb87455a66d 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c @@ -30,7 +30,6 @@ #include #include #include -#include =20 #define NLMDBG_FACILITY NLMDBG_SVCLOCK =20 @@ -496,7 +495,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *fi= le, (long long)lock->fl.fl_end, wait); =20 - if (!exportfs_lock_op_is_async(inode->i_sb->s_export_op)) { + if (!locks_can_async_lock(nlmsvc_file_file(file)->f_op)) { async_block =3D wait; wait =3D 0; } @@ -550,7 +549,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *fi= le, * requests on the underlaying ->lock() implementation but * only one nlm_block to being granted by lm_grant(). */ - if (exportfs_lock_op_is_async(inode->i_sb->s_export_op) && + if (locks_can_async_lock(nlmsvc_file_file(file)->f_op) && !list_empty(&block->b_list)) { spin_unlock(&nlm_blocked_lock); ret =3D nlm_lck_blocked; diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index a366fb1c1b9b..a061987abee3 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -7953,9 +7953,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compo= und_state *cstate, fp =3D lock_stp->st_stid.sc_file; switch (lock->lk_type) { case NFS4_READW_LT: - if (nfsd4_has_session(cstate) || - exportfs_lock_op_is_async(sb->s_export_op)) - flags |=3D FL_SLEEP; fallthrough; case NFS4_READ_LT: spin_lock(&fp->fi_lock); @@ -7966,9 +7963,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compo= und_state *cstate, type =3D F_RDLCK; break; case NFS4_WRITEW_LT: - if (nfsd4_has_session(cstate) || - exportfs_lock_op_is_async(sb->s_export_op)) - flags |=3D FL_SLEEP; fallthrough; case NFS4_WRITE_LT: spin_lock(&fp->fi_lock); @@ -7988,15 +7982,10 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_com= pound_state *cstate, goto out; } =20 - /* - * Most filesystems with their own ->lock operations will block - * the nfsd thread waiting to acquire the lock. That leads to - * deadlocks (we don't want every nfsd thread tied up waiting - * for file locks), so don't attempt blocking lock notifications - * on those filesystems: - */ - if (!exportfs_lock_op_is_async(sb->s_export_op)) - flags &=3D ~FL_SLEEP; + if (lock->lk_type & (NFS4_READW_LT | NFS4_WRITEW_LT) && + nfsd4_has_session(cstate) && + locks_can_async_lock(nf->nf_file->f_op)) + flags |=3D FL_SLEEP; =20 nbl =3D find_or_allocate_block(lock_sop, &fp->fi_fhandle, nn); if (!nbl) { --=20 2.44.0 From nobody Sat Nov 30 04:26:07 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D97931BAEFF for ; Wed, 11 Sep 2024 19:43:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726083815; cv=none; b=c+X+Og3twpQuWpkWTYln7hI025Gez/mUW3QczcBTzYNXVft/R7Df956EWDLyHylVwgzHY6HgTE0eOklanzFb2RXrYxl3/3fUO9hm/t+dZaWBnx1RuHp2AdQ6ffwwcjraxZrj3EaqZqqK+L+d/Ii/tgAb9DlwnM7onejv4f5TybM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726083815; c=relaxed/simple; bh=ePfUocyP7grZ5CDYVXoBDNFKwP41bxMPDU//9kt//Gw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hFKXG9kYWPhl1A4jqFcqf76st+MI8u1fv/gDRNsChLhQVK6Qwg6ZsiGzI7SeiaNS7zM3KF0LeQom6fjQ62t23CkDNiOSl15n/nvEBnmRsy3pRyKPuIYLcnaDHGhkeH38GavUVPWji11Bh0jBVpekKz6/LNKLrYcPfXUhGxutpYM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KDJGtqkh; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KDJGtqkh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726083813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/RZ3edwXcia6MZkZjPsBRO16l+GEAsyaTjIaabh2Mx0=; b=KDJGtqkhC7JlK0uQYHqAywnovr4teJylXn3OW4Pgj2TMQ0Q4hvvnmOsPnsAtwi7WJYayrQ o4wHJ0rWldd4eD71CGSTnAwwO5JIHvdCqZJD4Tlf+4/KjzTVOnEcMXD65QSZCyxb4BF/by LXMVljreCpOYTFOLisbr9ktNbTizNss= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-682-Vl4PSZm0M46c4jBtI8fjnw-1; Wed, 11 Sep 2024 15:43:29 -0400 X-MC-Unique: Vl4PSZm0M46c4jBtI8fjnw-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 861721956089; Wed, 11 Sep 2024 19:43:26 +0000 (UTC) Received: from bcodding.csb.redhat.com (unknown [10.22.48.7]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 16B8B1956086; Wed, 11 Sep 2024 19:43:21 +0000 (UTC) From: Benjamin Coddington To: Chuck Lever , Jeff Layton , Amir Goldstein , Neil Brown , Trond Myklebust , Anna Schumaker , Jonathan Corbet , Andreas Gruenbacher , Mark Fasheh , Joel Becker , Joseph Qi , Alexander Viro , Christian Brauner , Jan Kara , Alexander Ahring Oder Aring Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, gfs2@lists.linux.dev, ocfs2-devel@lists.linux.dev Subject: [PATCH v1 4/4] exportfs: Remove EXPORT_OP_ASYNC_LOCK Date: Wed, 11 Sep 2024 15:43:00 -0400 Message-ID: <0a114db814fec3086f937ae3d44a086f13b8de26.1726083391.git.bcodding@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" Now that GFS2 and OCFS2 are signalling async ->lock() support with FOP_ASYNC_LOCK and checks for support are converted, we can remove EXPORT_OP_ASYNC_LOCK. Signed-off-by: Benjamin Coddington Acked-by: Chuck Lever > Reviewed-by: Jeff Layton --- Documentation/filesystems/nfs/exporting.rst | 7 ------- fs/gfs2/export.c | 1 - fs/ocfs2/export.c | 1 - include/linux/exportfs.h | 13 ------------- 4 files changed, 22 deletions(-) diff --git a/Documentation/filesystems/nfs/exporting.rst b/Documentation/fi= lesystems/nfs/exporting.rst index f04ce1215a03..de64d2d002a2 100644 --- a/Documentation/filesystems/nfs/exporting.rst +++ b/Documentation/filesystems/nfs/exporting.rst @@ -238,10 +238,3 @@ following flags are defined: all of an inode's dirty data on last close. Exports that behave this way should set EXPORT_OP_FLUSH_ON_CLOSE so that NFSD knows to skip waiting for writeback when closing such files. - - EXPORT_OP_ASYNC_LOCK - Indicates a capable filesystem to do async lock - requests from lockd. Only set EXPORT_OP_ASYNC_LOCK if the filesystem h= as - it's own ->lock() functionality as core posix_lock_file() implementati= on - has no async lock request handling yet. For more information about how= to - indicate an async lock request from a ->lock() file_operations struct,= see - fs/locks.c and comment for the function vfs_lock_file(). diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c index d418d8b5367f..3334c394ce9c 100644 --- a/fs/gfs2/export.c +++ b/fs/gfs2/export.c @@ -190,6 +190,5 @@ const struct export_operations gfs2_export_ops =3D { .fh_to_parent =3D gfs2_fh_to_parent, .get_name =3D gfs2_get_name, .get_parent =3D gfs2_get_parent, - .flags =3D EXPORT_OP_ASYNC_LOCK, }; =20 diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 96b684763b39..b95724b767e1 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c @@ -280,5 +280,4 @@ const struct export_operations ocfs2_export_ops =3D { .fh_to_dentry =3D ocfs2_fh_to_dentry, .fh_to_parent =3D ocfs2_fh_to_parent, .get_parent =3D ocfs2_get_parent, - .flags =3D EXPORT_OP_ASYNC_LOCK, }; diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 893a1d21dc1c..1ab165c2939f 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h @@ -250,19 +250,6 @@ struct export_operations { unsigned long flags; }; =20 -/** - * exportfs_lock_op_is_async() - export op supports async lock operation - * @export_ops: the nfs export operations to check - * - * Returns true if the nfs export_operations structure has - * EXPORT_OP_ASYNC_LOCK in their flags set - */ -static inline bool -exportfs_lock_op_is_async(const struct export_operations *export_ops) -{ - return export_ops->flags & EXPORT_OP_ASYNC_LOCK; -} - extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid, int *max_len, struct inode *parent, int flags); --=20 2.44.0