Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1676634rdb; Thu, 25 Jan 2024 02:59:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEY9Y7K9tej41UOwordhs/3O9cDG+drzCL/84soo6z25AG70VS8XOzeVqtUBEE/fRw4ltZV X-Received: by 2002:a17:906:3a88:b0:a28:c04e:315b with SMTP id y8-20020a1709063a8800b00a28c04e315bmr777983ejd.13.1706180346461; Thu, 25 Jan 2024 02:59:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706180346; cv=pass; d=google.com; s=arc-20160816; b=BjOequnrw5fvM2t5EBh2sMW4qPP37d0SU0FlT55dJGee/oLZJJBowsi363R8O/Sera 4z8dqkbhVEnZDeuFLgnJRjQYVZ6YTXYpeJqDOAnOeIENb9ZaEqEP4FpBh2aHX1JqeTPQ sAmEQQG4MRaZMffB+197O1SlmUNPylU2f2xxMetrF4WROPM2717/G85sQoHMdET77X4c jfUdBeKIOHamZggNk8Ou/Ws2J3ISypauxrKc296wcgszkQA8hOYSU0odcNrF6UmZ332J WXq0ZAk1fnc0PXjQYnlm1gvnLJjlF9xEHhoFmRkaq3KYB6/Clk2/ZxqOPmLJd/nSb11R iPhg== 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=0RrqAUlQBFhWILWc/5DUjojGmS3l98jrucmA5zpWHWg=; fh=AED2lrIQZhdppGHbaRrNz6/BI48B+mbutB2egpFPmJc=; b=OGNaNAtUi1KcjUOuGXvzJ9dsGf7pha7ALOyXPJtWTwH1x4UN29gkwtG12at7NPLV/z Qa2es6sdRYA+DzSR81G6MGNhWJMDBfx6rMLUxWuoGAU81d/65j4dyrolOHKVK9CmTmoU 1AE5bfvLSaZA2Qfm+QsReK3ZYk2dSbBGL5RPgBRNF3BUZXrc0zYUZ9ecgKHdHj9AThsI ljqM/ZM9IPDHjbzeMOrSXmwMe418Z4guNs+4h8Gwr0eOtKF4R+d0c7htD8+tMabL2NI6 zC3bH9C22z7c5/ZWwAarOwxMlx4/Kdz2o7l8A6ybwmIhwKXWTY7iQAdePKj3k8lZpUTJ QHZQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Zny8bRHQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1360-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1360-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 l12-20020a170906a40c00b00a30fb91ac94si794814ejz.63.2024.01.25.02.59.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 02:59:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1360-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=Zny8bRHQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1360-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1360-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 086B31F20FCD for ; Thu, 25 Jan 2024 10:59:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E808F629E9; Thu, 25 Jan 2024 10:44:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Zny8bRHQ" 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 B31F2634ED; Thu, 25 Jan 2024 10:44:58 +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=1706179498; cv=none; b=foX/2lVtkQQ5G92ywDC21uMo3GCmZdUdM3nTmk1HzuUpi62cd1Jv8XMGfRLXbYFnDeMXF8emnyQ3uRsLAx3zXMR6wdwwLmuXPUp9i3KPmdpjaHBuEsPaBG95j6k7VByGWEfOsP+ojw6+rymjmO4HS3iFNI7kCKbNFjfMwa1jGsw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706179498; c=relaxed/simple; bh=nD9BEv1CjR2OEjVeGMUNguKQLxTTM6NPvUbffSU/wSk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M/tXyXrQCajMs1HnsOmnOxrM0vLh5GwjOG7uIep0NCkJXv/EPG7Vo08ewGcShy53QCrWYDGn8rBr0JZgBY7eCfdrVH5Y9LVCdm4//pNTJLIt12cQPV6DJxiIfyCK81vZ8LFLykJilT0okhAZeF5MzWpQ1El7+mhmemHq90SMIik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Zny8bRHQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F15B9C43390; Thu, 25 Jan 2024 10:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706179498; bh=nD9BEv1CjR2OEjVeGMUNguKQLxTTM6NPvUbffSU/wSk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Zny8bRHQmNv4M03mIxXaXtc0dCpUSLo1Se3qED43JoJs2I8LBsReArD6qamVjqiH+ hR7ap85HlxCSXtnGVBsGHxxETKBi6thUDStd9Z2TAO+t3K/RRk2EZgXI7ANY3mNYyL rGxPXFCO9lwl2FgaFDo7FwvojU96rn5chhT1Y4Iy8CzSchD3qmgeGyaGYQEIa1t/Az fkYMxVvd0otc3kmiEVUqGRtF7/rdVySNFmGmAT2IChRc35/2SsLKDTga9Ifl4Ipx/W C82VcLFX0r4I5kjMVzAxwW5M161EtBjeQE0bT6xHwq/xhdcVvWijNXC/gMAzID17XL VK/mcwYHCZpCw== From: Jeff Layton Date: Thu, 25 Jan 2024 05:43:08 -0500 Subject: [PATCH v2 27/41] filelock: convert locks_translate_pid to take file_lock_core 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-27-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=3137; i=jlayton@kernel.org; h=from:subject:message-id; bh=nD9BEv1CjR2OEjVeGMUNguKQLxTTM6NPvUbffSU/wSk=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlsjs9y/o7I1K7nhN5OVz7m4BnLP++BiaKwndRm iQSPatwv8iJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbI7PQAKCRAADmhBGVaC Fa+EEAChdI4fiS8GaZOJEUHs4gt7453mUL0TceiKxymqOqdC1MkeSsPi7KSeMaCfKGZDe5XUYxX jIS7vgHQmQoeEvJIuke5wfJU26K1YlXcSomHhUpAI+KUIel1EkV7Bwhr1DSYinF9aRA0XWaTLGl X2gcDZIdPeiA1yM3MXSOCDCpxjS7PW2fktGxR48kNDnq0Q8cRuVWeB3u/rUkC4o/vEHmTmyX+ho j4i9MEslLYEAuQ1eXGwf1903oRh9831rIUszxkXpYt05TPDnVU3emG/kbX7FoxeQr1i0XI99r8o ByPaFwjUv/MfpWtr+LnjSIRXWO7QokFkHQcRUrvdDPX1j8flHM/QuJ4I5LZQQVGXZE1IhEfiBzH Lq0I0sJissOACy7C+s6EIyGClcQy1U5+1zCPsSVYGpxUDASptnnsZgKRyhov4Xn+IGtKCle6/RB dcXAvQo68oCLUKw/KJpuVMo20Nj47knGoejWzc6OTJLsXojAQWn4DmsojyadRcG59mjt3UbdOfq n7mmjncdQnOdsobfNHXZaJCiMArPKIKQssxI95UnucqvAcHEalb5jNmN+iV1G02Fg6LHtrMl/ON /172GK5Eqas4o0+B9qTS8GBc0XvlXNj5tgHQadDAU/wfnECvA/gLEyQGmpheWvu//Vgnv/xi4An 3RK1bGttIkX+hag== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 Signed-off-by: Jeff Layton --- fs/locks.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index 0491d621417d..e8afdd084245 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -2169,17 +2169,17 @@ EXPORT_SYMBOL_GPL(vfs_test_lock); * * Used to translate a fl_pid into a namespace virtual pid number */ -static pid_t locks_translate_pid(struct file_lock *fl, struct pid_namespace *ns) +static pid_t locks_translate_pid(struct file_lock_core *fl, struct pid_namespace *ns) { pid_t vnr; struct pid *pid; - if (fl->fl_core.flc_flags & FL_OFDLCK) + if (fl->flc_flags & FL_OFDLCK) return -1; /* Remote locks report a negative pid value */ - if (fl->fl_core.flc_pid <= 0) - return fl->fl_core.flc_pid; + if (fl->flc_pid <= 0) + return fl->flc_pid; /* * If the flock owner process is dead and its pid has been already @@ -2187,10 +2187,10 @@ static pid_t locks_translate_pid(struct file_lock *fl, struct pid_namespace *ns) * flock owner pid number in init pidns. */ if (ns == &init_pid_ns) - return (pid_t) fl->fl_core.flc_pid; + return (pid_t) fl->flc_pid; rcu_read_lock(); - pid = find_pid_ns(fl->fl_core.flc_pid, &init_pid_ns); + pid = find_pid_ns(fl->flc_pid, &init_pid_ns); vnr = pid_nr_ns(pid, ns); rcu_read_unlock(); return vnr; @@ -2198,7 +2198,7 @@ static pid_t locks_translate_pid(struct file_lock *fl, struct pid_namespace *ns) static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl) { - flock->l_pid = locks_translate_pid(fl, task_active_pid_ns(current)); + flock->l_pid = locks_translate_pid(&fl->fl_core, task_active_pid_ns(current)); #if BITS_PER_LONG == 32 /* * Make sure we can represent the posix lock via @@ -2220,7 +2220,7 @@ static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl) #if BITS_PER_LONG == 32 static void posix_lock_to_flock64(struct flock64 *flock, struct file_lock *fl) { - flock->l_pid = locks_translate_pid(fl, task_active_pid_ns(current)); + flock->l_pid = locks_translate_pid(&fl->fl_core, task_active_pid_ns(current)); flock->l_start = fl->fl_start; flock->l_len = fl->fl_end == OFFSET_MAX ? 0 : fl->fl_end - fl->fl_start + 1; @@ -2726,7 +2726,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl, struct pid_namespace *proc_pidns = proc_pid_ns(file_inode(f->file)->i_sb); int type = fl->fl_core.flc_type; - pid = locks_translate_pid(fl, proc_pidns); + pid = locks_translate_pid(&fl->fl_core, proc_pidns); /* * If lock owner is dead (and pid is freed) or not visible in current * pidns, zero is shown as a pid value. Check lock info from @@ -2819,7 +2819,7 @@ static int locks_show(struct seq_file *f, void *v) cur = hlist_entry(v, struct file_lock, fl_core.flc_link); - if (locks_translate_pid(cur, proc_pidns) == 0) + if (locks_translate_pid(&cur->fl_core, proc_pidns) == 0) return 0; /* View this crossed linked list as a binary tree, the first member of fl_blocked_requests -- 2.43.0