From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796394447; b=bgygaYg8ga7fCI+cVE9dwtHKQ5vaGjN7XsPaz7HqDvjL2JS/lTTh0nmBZir7K2ULY9nX vzd1fazUia+Dcoz5sVCZ7j6DV62qwQAKiqx6rC9CSlQNwXu1HXFkCJYhEuXzYM1Kf/DfC F1wpeQdOYaeKTyJnw4qnVjMIY1k10jMpS8p3ejLjV+G4rNb2NOJ8elDAvVM00UKgShPJg rNqacw3jn8gMZQY2YvfFckQ+pkTSzuWlMvoCYYiarSE1sUsm3Zs+XiUiWdXek2dHthYWm JpJUIwesfEHniPTmeAvxTZXiDeFdpRKC3qkZATeK8mABwa4W6y4h+ud3xgLoLGHUlxQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796394447; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Sender:Received:From: To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=ZHNwUt5G1V9cXQnYhODVKxrV3fgAmNZTG6uqCt2JJXE=; b=gMcsdGzfRkc2uv/cExXyZJD2F/4h8xVfaVV+3G2I6MmychwwYA5IJG6TEVtw1ZES947N zKNubSjkDBuc7um05kZH+hd+2Hp2RGyu7t69hPUxoZl7WSNq310+Y6Wp8rDy7tuNvlJrL brvEfdDd5A4VeaxcPTz3zh8XDsD+RpGV8pOloyPlHsmbJCBZrrOanXjEVoRISDdom6khA x6f5yBkHvUxCWqAzVFhfUDHGXNgXv/ctJoYpzkToD3BT4tsfRdbQ7uKDxHEPmYEgPIzRb Sl+fJVfb5CvyOKPBhaT5nl0h7qxgBgdl4YhZ4UpjQxpigBxBCOv/J+Ugwi1DuC9sTpw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=gsr65jRy; arc=none smtp.remote-ip=209.85.221.41 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E00AA606A322 for ; Fri, 4 Dec 2026 14:27:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E00AA606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=gsr65jRy Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-4a5024b3c28so1231204f8f.0 for ; Fri, 04 Dec 2026 06:27:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796394445; x=1796999245; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ZHNwUt5G1V9cXQnYhODVKxrV3fgAmNZTG6uqCt2JJXE=; b=gsr65jRyQeybWE6mQboUKVg0MLIy5j0LICQz5pxJAobWcWWbp/cSUY3hEkqPVRTRWM RptlqqHSjREk8h77pXGK1/K8LqTRAB2AuARLimnFJ9bC6ADDdk9fh4YAebkbSmqnuL/Z qbUtc6RDW6oMKovo6rDlssUchq2SL/TPFASsdE20hF9X7J9cHsf9LAFCN7NMB5Z58KFa hjFvbckaFa+ljpK89MVyAySl5f+qppdwBkA/8X0QiPPRoYmEoltn/X2h9A2Pt7kMEsLJ TW/5WOiXYyp9TknoYYi8Lr3W2FP6XgD7PY9QOiTzAuDImas47zkJMMlL+nBtWOL1dMRn bCOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796394445; x=1796999245; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ZHNwUt5G1V9cXQnYhODVKxrV3fgAmNZTG6uqCt2JJXE=; b=1aA4+Y6a5ADV2HCjnUbSgIhcIVgrbU5tH3RSxhwcHDbDMFZEFmeuX4cGvhFl9xVna6 JDRSWOmc6GJTWA5e4n/WwpSSKUI4NRABH2a0nQA/Ryu3o3Rwr+xo6LN09sivznz2OgY+ JHzOtJJbfLhkFYDICpu3GGlWNr3egkHHQZPA5xMHkWm+UFHSNeUcXYLR0/vVM8TXlUcj Ystn1o4rB01oPeh1z1DyaKJQmNhHhIjZkxhtn2m5rEs7ocMdiCBZDS0P93TohpT3BWGV q0eQOgu/qdiFZYOklJArpj/FFikLkYIOqAnwT854AXCfhMVdrAqf+zSyFXsBTma9PIJu d0dg== X-Gm-Message-State: APuU4Z8Gv8IxpS1m0UCHWgytK0G2NPkWZJLDcb5O7tXrYYzgRY49csAb S35eODHiQI1P61/RhFIZeK0SwaSbj4J+skClzWn7xroSGWL96dcIyrZp X-Gm-Gg: AZFdTZcrVvgRWg2bFrj9aKgXpubf/hyQwqm7JPWgmwrTESV9yXB4HYw/sXfDnNCOvh7 1sYphv4XXQobtmt1zelEkYlyoRAAGWIIa6AhAUIeyJv6J40+YoMijWNdp23/bPwGfK6Mg8m2+np QXaVxU02U4hmSvk95WxFS3OtnvRjEtPu0HnHW+n4PZ9JnLhzzkkGutQAo+emuZjJ+AtR1DOFDNW vsJx5rJvA18J8s58p9bMzxrk7wRLCO/wWYO21cdHG4UDErGJUhI37elwOpjrzUBezIMSpsZbNgN x+StOKzVJ8lmxv7bwMob2yx+XTzx27eQ0dab2nxWmf82t2BKbkgUSVoC1RtyCDvd6ZPv34BOOye I1vD2jbMk2zKy/hOwkYyAQ/+HCGG7HlQk9Jefdeddc9xOuGcWdAR4PLO3v7cy5wV6EXhrremreM qc5/TzurOGrGytvf1eFJ5g1Kc+hkDxUNUPzLTDn9H008iiiS9tvcKRRGScFTvabiNlTPQmKfKXZ X1CsyjUz93U1S4ShQFnpnAleHB+Em1j1K3VZR2KfVRG0LyvbhaOPM0desUXlOla9liFMd8RDO7A o5n0ggndwn581IFgVD8zZ+0GP2JZ1kcuwAJPFUbpUBtY47yF2zUfe0mJR6D2nWWik1K2XDlfeEc oyKNGje7b0Q== X-Received: by 2002:a05:600c:4e52:b0:4b4:a551:681a with SMTP id 5b1f17b1804b1-4bbeb8512bemr44579835e9.3.1796394445148; Fri, 04 Dec 2026 06:27:25 -0800 (PST) Received: from eldamar.lan (c-82-192-247-196.customer.ggaweb.ch. [82.192.247.196]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbeb6f0085sm45486035e9.4.2026.12.04.06.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 06:27:24 -0800 (PST) Sender: Salvatore Bonaccorso Received: by eldamar.lan (Postfix, from userid 1000) id 04DEBDC04A2; Fri, 04 Dec 2026 15:27:23 +0100 (CET) From: Salvatore Bonaccorso To: Julien Leclerc , Jeff Layton Cc: linux-nfs@vger.kernel.org, 1153524@bugs.debian.org, Chuck Lever , regressions@lists.linux.dev, stable@vger.kernel.org, Benjamin Coddington , Christian Brauner , Salvatore Bonaccorso Subject: [PATCH 1/4] fs: Introduce FOP_ASYNC_LOCK Date: Fri, 4 Dec 2026 15:20:29 +0100 Message-ID: <20261204142703.1100372-2-carnil@debian.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261204142703.1100372-1-carnil@debian.org> References: <20261204142703.1100372-1-carnil@debian.org> X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Benjamin Coddington commit 8cf9a01edc216b16b5839eb793ac544d2c97ce97 upstream. 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 Link: https://lore.kernel.org/r/3330d5a324abe2ce9c1dafe89cacdc6db41945d1.1726083391.git.bcodding@redhat.com Reviewed-by: Jeff Layton Signed-off-by: Christian Brauner [Salvatore Bonaccorso: Resolve conflict in include/linux/fs.h. v6.12 already defines FOP_UNSIGNED_OFFSET as bit 5, so FOP_ASYNC_LOCK goes in as (1 << 6), its value in v6.13.] Signed-off-by: Salvatore Bonaccorso --- 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 bb44224c6676..c412ded9171e 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); } +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 fc63611ac3c6..57a9f2e1e23c 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2177,6 +2177,8 @@ struct file_operations { #define FOP_HUGE_PAGES ((__force fop_flags_t)(1 << 4)) /* Treat loff_t as unsigned (e.g., /dev/mem) */ #define FOP_UNSIGNED_OFFSET ((__force fop_flags_t)(1 << 5)) +/* Supports asynchronous lock callbacks */ +#define FOP_ASYNC_LOCK ((__force fop_flags_t)(1 << 6)) /* Wrap a directory iterator that needs exclusive inode access */ int wrap_directory_iterator(struct file *, struct dir_context *, -- 2.55.0