Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1967580rdb; Wed, 31 Jan 2024 15:11:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeJEkJB3poTpyQ5r+8YOwj3IKQt4CHlDEf6ucWJStRLqN4uGEiA+eSZ3ybtUWI8FrstDiL X-Received: by 2002:a05:620a:4d19:b0:783:63bc:3eb9 with SMTP id wa25-20020a05620a4d1900b0078363bc3eb9mr910277qkn.20.1706742676794; Wed, 31 Jan 2024 15:11:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706742676; cv=pass; d=google.com; s=arc-20160816; b=Fwwmohrm2idFrFK3VyJR1bFSaXAnwEY/l4g9sDOrX/qth5SZ3wBxajiYdW/DEwaczY 3sWnMGv+LCfXRxFB7yr0//dFzP3NqN35EPWa+Ar2/+VqtT0avU/R+x0yMVsXqmZ1LYKx ndoo2DOtZbE/dRzoSXx4E+O5ccktOU05aZNVCSI/S5uxL5Kbwv/EdGp2j2z47LowXd0u gBWjPpILLHn36BFQcGQXdeFAFrqaZC4XmvCXTWpg9Rp5A+9FN0sXtB8gVVbrKy3+i6ZF /cBRP/zprofRJVtlZMEx91umRwdIt6NsAFlu9DrJeCsGndhucYxRH3B6lzUd1c5/H5zS K2xA== 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=/cag/1OzPGD4KejgG+dv3jlpUvK5R6Tt5EuAVjC15w8=; fh=7NZiSAZrRYszuatpSaNV39b2cM2fzEN2iHI8EfXs2Vg=; b=Puw67huwPbJ3hHp9PxNBwKoYUYkMzdQiJ7G0U4fuWB6J2fljO7zArA/Sff7fVsHV9b wLtaoUXLiF7f/THLMZd2umTwpc8KhCNCEoRsZoEzzQDG2ojXpUag9z6L4EMIi5TxTzto yhz6VlNGwVHNUIBNn57q0REkNEkUCf0zAE8rLIVsgv1r4Qj/c1F3RVMNmyQyEALhkkBH CrZ6VrKA/4Lffd0Za5CbHqATD1lTjFXy/hHyHlkMU2gSPkyq0fecoTHNWmDocNyjIx0O VRT8DWvCT2OZIXb5m6EWdIvua38HFILubCFO2QHz8i3M6m9FBmjj3lAh7jS5xKC8Boc3 MIXw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KJNXNX01; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1656-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s15-20020a05620a29cf00b00783da74f20bsi13356235qkp.333.2024.01.31.15.11.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 15:11:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KJNXNX01; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1656-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CD3521C290ED for ; Wed, 31 Jan 2024 23:10:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82C2A3BB53; Wed, 31 Jan 2024 23:03:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KJNXNX01" 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 4912D135417; Wed, 31 Jan 2024 23:03:32 +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=1706742212; cv=none; b=lom9mkuH7PfbvXz5PeJpZCm3OQlPJ370lygJIiFF6OwUh5zkIPM/Lqgh4c6mYAYJV1Q6Qoqn6unQm77KnJy/hJBxHvx2hEuKjlHUEPJCoyt48eLXL900Isjr3T5bn3stWvcLqd3U2AIKpUxC5qnjP1jjFJSs7yTn1V6/I19xHek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706742212; c=relaxed/simple; bh=LUlgnzIHGDxpa01sAUBPp32VTGKZhkSS047Y1RIGETo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=keMEV1qhr0mfxv0Mhjudj4BfoisMcOEoC5lh7tz8XnAwjMhTeT3NIunV8O8xhOSRYlJw9bUYS2ffoBYiy682QxsfyE7Hm2CmEdFUQ1nXLubfUogyV6elaFCzA8/ZokYL7aZWtVqzICS283dLnyiflFjjc9Du6tlv2dmz/a/SZwQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KJNXNX01; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20AC6C43330; Wed, 31 Jan 2024 23:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706742211; bh=LUlgnzIHGDxpa01sAUBPp32VTGKZhkSS047Y1RIGETo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KJNXNX01BLpgzKf91gG/vhyMAQGVESz05jXQ2KoSaHa9t/6MhGX1YcfYRP5+gcpio +KM0zSeXPYXQOzE+eRfEyEUxh2fgLSsA/10EXvN2r+vmJnhZQGZvQzJUPN5BHJ1+q4 S3ZsEFGjYVBErlAdc29LtqjYRaa0kT6wHV0Dq884orS+GoKjfnR8zvLA3vsSEB2VPF GZW9ZxcOD9ol+9Tem0Ovme5wgeMNZuFaLLW1drpbkJ977vN7bIctCewSBzR7hfWHMw N1rQiGCWlKXLxPLZLw/Wm21VKSENzzyQxaMoBoufw204xWte8WYK9xf//bthEvhIgw w/d/alwv7ySSw== From: Jeff Layton Date: Wed, 31 Jan 2024 18:02:00 -0500 Subject: [PATCH v3 19/47] filelock: convert more internal functions to use 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: <20240131-flsplit-v3-19-c6129007ee8d@kernel.org> References: <20240131-flsplit-v3-0-c6129007ee8d@kernel.org> In-Reply-To: <20240131-flsplit-v3-0-c6129007ee8d@kernel.org> To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Chuck Lever , Alexander Viro , Christian Brauner , Jan Kara , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Xiubo Li , Ilya Dryomov , Alexander Aring , David Teigland , Andreas Gruenbacher , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Trond Myklebust , Anna Schumaker , Mark Fasheh , Joel Becker , Joseph Qi , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Namjae Jeon , Sergey Senozhatsky , Miklos Szeredi Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, v9fs@lists.linux.dev, linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org, gfs2@lists.linux.dev, linux-nfs@vger.kernel.org, ocfs2-devel@lists.linux.dev, linux-cifs@vger.kernel.org, Jeff Layton X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3884; i=jlayton@kernel.org; h=from:subject:message-id; bh=LUlgnzIHGDxpa01sAUBPp32VTGKZhkSS047Y1RIGETo=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlutFwJtCLZeIU9Lne+277W5PEf/mS3Kjpo1GEk ySyODO0GJSJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbrRcAAKCRAADmhBGVaC FeRgD/95NN3RAaP0Ip5JW93hdcuQegLRnznNkdlNtbRZPJAHI/W8imUm1teXtkdGUG1WT+QQoqX LwNaKJDkKVBQ9W6K8Ud212keBFEu0zHlAt+panPMG55SNQpwa+/OpP7lYgIYf30JdPE8Ff601Vs CpKyFGNuS0fhyGTs9koNnQ4U32v0z8smiBgd5nrKPxdIyUG8wAxobAl9fYDg6J11wFc7a85crty 1Kk99aN7ySeiG4xj+CE4a3KmuPh6hHHmBnjivAiSiwOBanRMfGsGXYR3YrMldFxsUpUKLCcVTtz +iTSTNnKwc75KpSQFRPenm36rgsbbKBSt0/f48jPKXzDIGhDg3Md8UJos4+ENSz1MdK4TvFbrjq MINQ77teT0K7VLjKCMSXo4oaqn7POF/nI2NpAseiDkP5SiIzidRV6vL2cGyW2ipUrBGVZt0YlPi gtNr8wPVt3GegSOpfE1VnvutylmDKf15XWIP1rvwE50i4jy/nxt8RzMyXSs016kBhq13eMSs3bm wqeEGZvq9pe1Z+HDtQ2kWorerPe1J8Cuz6p4maAcm37yT0QKuBYrCNNN5gWLOOIxRCCMT7dI3rf 721v7yruqbqe2VvED6qvnFDkxgQwW9cPXhS6Lu28DTsUjGfy+0NhezzPOKZY0iNTsptmq+4i8AX 5cAJnMokmeRcbcw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 Convert more internal fs/locks.c functions to take and deal with struct file_lock_core instead of struct file_lock: - locks_dump_ctx_list - locks_check_ctx_file_list - locks_release_private - locks_owner_has_blockers Signed-off-by: Jeff Layton --- fs/locks.c | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index f418c6e31219..5d25a3f53c9d 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -197,13 +197,12 @@ locks_get_lock_context(struct inode *inode, int type) static void locks_dump_ctx_list(struct list_head *list, char *list_type) { - struct file_lock *fl; + struct file_lock_core *flc; - list_for_each_entry(fl, list, c.flc_list) { - pr_warn("%s: fl_owner=%p fl_flags=0x%x fl_type=0x%x fl_pid=%u\n", list_type, - fl->c.flc_owner, fl->c.flc_flags, - fl->c.flc_type, fl->c.flc_pid); - } + list_for_each_entry(flc, list, flc_list) + pr_warn("%s: fl_owner=%p fl_flags=0x%x fl_type=0x%x fl_pid=%u\n", + list_type, flc->flc_owner, flc->flc_flags, + flc->flc_type, flc->flc_pid); } static void @@ -224,20 +223,19 @@ locks_check_ctx_lists(struct inode *inode) } static void -locks_check_ctx_file_list(struct file *filp, struct list_head *list, - char *list_type) +locks_check_ctx_file_list(struct file *filp, struct list_head *list, char *list_type) { - struct file_lock *fl; + struct file_lock_core *flc; struct inode *inode = file_inode(filp); - list_for_each_entry(fl, list, c.flc_list) - if (fl->c.flc_file == filp) + list_for_each_entry(flc, list, flc_list) + if (flc->flc_file == filp) pr_warn("Leaked %s lock on dev=0x%x:0x%x ino=0x%lx " " fl_owner=%p fl_flags=0x%x fl_type=0x%x fl_pid=%u\n", list_type, MAJOR(inode->i_sb->s_dev), MINOR(inode->i_sb->s_dev), inode->i_ino, - fl->c.flc_owner, fl->c.flc_flags, - fl->c.flc_type, fl->c.flc_pid); + flc->flc_owner, flc->flc_flags, + flc->flc_type, flc->flc_pid); } void @@ -274,11 +272,13 @@ EXPORT_SYMBOL_GPL(locks_alloc_lock); void locks_release_private(struct file_lock *fl) { - BUG_ON(waitqueue_active(&fl->c.flc_wait)); - BUG_ON(!list_empty(&fl->c.flc_list)); - BUG_ON(!list_empty(&fl->c.flc_blocked_requests)); - BUG_ON(!list_empty(&fl->c.flc_blocked_member)); - BUG_ON(!hlist_unhashed(&fl->c.flc_link)); + struct file_lock_core *flc = &fl->c; + + BUG_ON(waitqueue_active(&flc->flc_wait)); + BUG_ON(!list_empty(&flc->flc_list)); + BUG_ON(!list_empty(&flc->flc_blocked_requests)); + BUG_ON(!list_empty(&flc->flc_blocked_member)); + BUG_ON(!hlist_unhashed(&flc->flc_link)); if (fl->fl_ops) { if (fl->fl_ops->fl_release_private) @@ -288,8 +288,8 @@ void locks_release_private(struct file_lock *fl) if (fl->fl_lmops) { if (fl->fl_lmops->lm_put_owner) { - fl->fl_lmops->lm_put_owner(fl->c.flc_owner); - fl->c.flc_owner = NULL; + fl->fl_lmops->lm_put_owner(flc->flc_owner); + flc->flc_owner = NULL; } fl->fl_lmops = NULL; } @@ -305,16 +305,15 @@ EXPORT_SYMBOL_GPL(locks_release_private); * %true: @owner has at least one blocker * %false: @owner has no blockers */ -bool locks_owner_has_blockers(struct file_lock_context *flctx, - fl_owner_t owner) +bool locks_owner_has_blockers(struct file_lock_context *flctx, fl_owner_t owner) { - struct file_lock *fl; + struct file_lock_core *flc; spin_lock(&flctx->flc_lock); - list_for_each_entry(fl, &flctx->flc_posix, c.flc_list) { - if (fl->c.flc_owner != owner) + list_for_each_entry(flc, &flctx->flc_posix, flc_list) { + if (flc->flc_owner != owner) continue; - if (!list_empty(&fl->c.flc_blocked_requests)) { + if (!list_empty(&flc->flc_blocked_requests)) { spin_unlock(&flctx->flc_lock); return true; } -- 2.43.0