Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1674364rdb; Thu, 25 Jan 2024 02:52:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IF5tDwcBs/FShHzXRre58vOK3UvBk8J514tL/qL6F++yXIIzMiBSUpSPhnCxKU1WSAmf2/t X-Received: by 2002:aa7:d654:0:b0:55c:9473:54ad with SMTP id v20-20020aa7d654000000b0055c947354admr550658edr.1.1706179965735; Thu, 25 Jan 2024 02:52:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706179965; cv=pass; d=google.com; s=arc-20160816; b=SthneEZwKbjjQLMpH27uqMThajU2dLt/eceu7CPb5IdqaSqxLXyZo96CV+xpLx4dFX yPtaIgDhYC8OmdWzGrdUBgFBQfJOGoPUV67If47YZGkqDcJtgzGeFsXwUOe3ZNmjsHVi Xcjomm2zQxL5U+C9aITly0msrEMYlTp1g04ODSgVDjD8bhC+KMQfSOanQy7Cgix9ADYt Rn5ubBJDyJZQg3Nhwojnh1f6Dj2P7my24PGm/GYaIXx5lSXl0MM4smPPNEF6q7DIAbqp A9fL2WbzUpr4Tn/BcYDj1B0RwJk8gctgC2U883ALaCzGMsNUBJR9SIkNdO/yhgwhN1pl /wzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=SEV8ihs10JZRlLilcAHdlnQE7ZkhXTT2HALdugyAHSs=; fh=AED2lrIQZhdppGHbaRrNz6/BI48B+mbutB2egpFPmJc=; b=CtXGnbJzEvqPXKYdidCgKBtPbH7RlILknw+3eWDJTuxvN9eBDdQv2EKFKmRvbuZ5hv PleKGeN20h2jEmnwljNV5iRioncVlipZgXfqdswRkxBXqRbMWLfJHx6CXD+p65OgF0Cp Ha3+dfE3S3EV2OcWuq3G1dB57B1J+PB9v/lkihQEooaXFIiYefyWe9hmqH5ZlQP20aaE YPhZStzXrgtdQBIr5aZtL+MiyRAOqz6yjBGdMq+xmOZ2JDCo2i065a77P5+KhCe8VyLQ fvvTSiH3A0WYi9on8bEVjsQdK1MJ4O9jyxS177x8e5156P5fEvqDy+YHGZkVZq8I9S+8 WZIQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PEKy+7Lq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1348-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1348-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i34-20020a0564020f2200b0055a47d6a782si7527413eda.27.2024.01.25.02.52.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 02:52:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1348-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PEKy+7Lq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1348-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1348-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5688C1F21B9A for ; Thu, 25 Jan 2024 10:52:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 348D45D745; Thu, 25 Jan 2024 10:44:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PEKy+7Lq" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EE6B55EE89; Thu, 25 Jan 2024 10:44:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706179453; cv=none; b=K/YFX49z9snBUnqCjPFMVW/FTGRjGKB3hxKYGUOAKJd9jR9ittLazcX8cu0ffWpPK333OQusyOgksEu2Gu6/mSprf0x3UHzjichn4b05spllzY6yUgt8dn7i56Yi5LRzorsw9yZzOaTDCNGANoYgw1rarISvUYu1DND7kUAcYYY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706179453; c=relaxed/simple; bh=EJNBZW+LLuEn3xUVX9XN4afgk7jPakpgPOqIPlOYvJY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JuB88tP5PUZsgiaQZ7AjMydNWX4AddCGelLB3ZrBD6LTfxohIEIDc+VawLt7H7VsPwvqWOrIqdKwcZjcavJYnGYbQ6wd7hQn4y9sHa9u3SIP8fF14osRuopDZTgIbFUPirVYXzRhmfHlAvMhC5ysCW0kPt5uLQJSAqATjbFqG+c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PEKy+7Lq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC006C433B2; Thu, 25 Jan 2024 10:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706179452; bh=EJNBZW+LLuEn3xUVX9XN4afgk7jPakpgPOqIPlOYvJY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PEKy+7Lq/Vj9Hge0FNhcZugnvOohrqWeEMkjfVBdUC7JABzmDY8lX8kpO8HUPfKUy YIQLPdcKseQ3BLSguSE+nT6rePbiF0HY0aSsGfEtlAY78xYcp7MvpcNIn+rwzZSREi BGqlmFHH8Y2IjAvKp6zr9tnJbugJoQtd/1K1AIaPgQ+huCezMqgGrSEBCPxr7CXdUX VmqeZ+RvS3pRdnzjkgqbKwPhD6DJLec2wVHnOfM1X/yhl5h+cUFniHs4G2YcolLkyR 9VB0sDtjJW6IZsXg2mf/QhUd7wbGpp+11BidT11jJPYI6aytwSXwNmcqFLu/g7346Q bkb2vVTUvHnHg== From: Jeff Layton Date: Thu, 25 Jan 2024 05:42:56 -0500 Subject: [PATCH v2 15/41] filelock: make posix_same_owner take file_lock_core pointers Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240125-flsplit-v2-15-7485322b62c7@kernel.org> References: <20240125-flsplit-v2-0-7485322b62c7@kernel.org> In-Reply-To: <20240125-flsplit-v2-0-7485322b62c7@kernel.org> To: Christian Brauner , Alexander Viro , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Xiubo Li , Ilya Dryomov , Alexander Aring , David Teigland , Miklos Szeredi , Andreas Gruenbacher , Trond Myklebust , Anna Schumaker , Chuck Lever , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Jan Kara , Mark Fasheh , Joel Becker , Joseph Qi , Steve French , Paulo Alcantara , Shyam Prasad N , Namjae Jeon , Sergey Senozhatsky , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Ronnie Sahlberg Cc: linux-kernel@vger.kernel.org, v9fs@lists.linux.dev, linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org, gfs2@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, ocfs2-devel@lists.linux.dev, linux-cifs@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2990; i=jlayton@kernel.org; h=from:subject:message-id; bh=EJNBZW+LLuEn3xUVX9XN4afgk7jPakpgPOqIPlOYvJY=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlsjs7rYwvH2rD3o3kb7U1gLb9iX3/J/FNVo9D9 r3XPVCLxqiJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbI7OwAKCRAADmhBGVaC FSZ/D/4jh2uL532A/N8MctS2m4IUVd0Btl1ASiXZdozpMjjq8cukVOxlZ+0FKxA0MaHzMbFwx3x wygRIPHTsTfO5st+u0mjrThJM59CQhoFLPtLAkfZ0zGBzcGm8E+anyb/8EorLLke8nTGH83Zjqg bqiT0/uBZfSmIoIFdVbOhIMr1w9heRkJf5IBfvnpAzIucH0s+oZPNm2dyE2oDZdzHNY3QAxhMBT YmC2VhiahlUEJkhcwfiTEORym/TxmVXiDAI1ckuicDhsIoqQzt5KzsLdJcNNgFbI7D/Q+Tei/D7 IOa6i7HZ87Qur+9FgmijtNDhHUufLCM5/Ai0YVZepMBSGiCLFOVryFK/SYSeI/V4bgri+XAA9Ri /SckKUOfW4TuwfooVDG7sJoNPkUHZSrCCGMTqfXcZsdJSq2PEEixkfHde0IJfwFBBZTTmFQWy1v I5r1E3C5VzpdrIGAjc+Rvcuj0M3u1g+TwlQev4d0A5NWcHivSDBa3HaF+pIteDE67lTGtZuOonk 1E2YzgHBmTF7s8fXFb4sEvYI/+JQGhmF3qsOKelmFd71YA9Xxo666TsXHhMwA2W3VfcqbPVVsQN 9F0ovCojk1jjcqd9px4PDXX4Qr1AeLzxuBH3/GnIKNwYnb1NbM73koCXiu9YbLwyFwCebsRmAsC D8XB3FT6VOddPyw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 Change posix_same_owner to take struct file_lock_core pointers, and convert the callers to pass those in. Signed-off-by: Jeff Layton --- fs/locks.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index a0d6fc0e043a..bd0cfee230ae 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -590,9 +590,9 @@ static inline int locks_overlap(struct file_lock *fl1, struct file_lock *fl2) /* * Check whether two locks have the same owner. */ -static int posix_same_owner(struct file_lock *fl1, struct file_lock *fl2) +static int posix_same_owner(struct file_lock_core *fl1, struct file_lock_core *fl2) { - return fl1->fl_core.flc_owner == fl2->fl_core.flc_owner; + return fl1->flc_owner == fl2->flc_owner; } /* Must be called with the flc_lock held! */ @@ -857,7 +857,7 @@ static bool posix_locks_conflict(struct file_lock *caller_fl, /* POSIX locks owned by the same process do not conflict with * each other. */ - if (posix_same_owner(caller_fl, sys_fl)) + if (posix_same_owner(&caller_fl->fl_core, &sys_fl->fl_core)) return false; /* Check whether they overlap */ @@ -875,7 +875,7 @@ static bool posix_test_locks_conflict(struct file_lock *caller_fl, { /* F_UNLCK checks any locks on the same fd. */ if (caller_fl->fl_core.flc_type == F_UNLCK) { - if (!posix_same_owner(caller_fl, sys_fl)) + if (!posix_same_owner(&caller_fl->fl_core, &sys_fl->fl_core)) return false; return locks_overlap(caller_fl, sys_fl); } @@ -978,7 +978,7 @@ static struct file_lock *what_owner_is_waiting_for(struct file_lock *block_fl) struct file_lock *fl; hash_for_each_possible(blocked_hash, fl, fl_core.flc_link, posix_owner_key(block_fl)) { - if (posix_same_owner(fl, block_fl)) { + if (posix_same_owner(&fl->fl_core, &block_fl->fl_core)) { while (fl->fl_core.flc_blocker) fl = fl->fl_core.flc_blocker; return fl; @@ -1005,7 +1005,7 @@ static int posix_locks_deadlock(struct file_lock *caller_fl, while ((block_fl = what_owner_is_waiting_for(block_fl))) { if (i++ > MAX_DEADLK_ITERATIONS) return 0; - if (posix_same_owner(caller_fl, block_fl)) + if (posix_same_owner(&caller_fl->fl_core, &block_fl->fl_core)) return 1; } return 0; @@ -1178,13 +1178,13 @@ static int posix_lock_inode(struct inode *inode, struct file_lock *request, /* Find the first old lock with the same owner as the new lock */ list_for_each_entry(fl, &ctx->flc_posix, fl_core.flc_list) { - if (posix_same_owner(request, fl)) + if (posix_same_owner(&request->fl_core, &fl->fl_core)) break; } /* Process locks with this owner. */ list_for_each_entry_safe_from(fl, tmp, &ctx->flc_posix, fl_core.flc_list) { - if (!posix_same_owner(request, fl)) + if (!posix_same_owner(&request->fl_core, &fl->fl_core)) break; /* Detect adjacent or overlapping regions (if same lock type) */ -- 2.43.0