From patchwork Wed Jan 31 23:01:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 195022 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp81638dyc; Wed, 31 Jan 2024 15:10:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvkwnp9NlaqK8kb7hMOF+vYbnfE4xx2GVfO4/y21JlQFf0KwUdtXl76dsd4uI/hfg4ujuY X-Received: by 2002:a17:902:d342:b0:1d9:e2b:dba7 with SMTP id l2-20020a170902d34200b001d90e2bdba7mr2750437plk.5.1706742634496; Wed, 31 Jan 2024 15:10:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706742634; cv=pass; d=google.com; s=arc-20160816; b=wlkd2jesHpNgujNV3PHsKvuK7Sdpq8aJ6VED6zIY2RQ2VtEGIvG8f3kQ6bWXP/gnkj bI7rZCN6f2OnE1qlf4i+nmD7XNGglZYQzv+qqve0QjGAbYRUAhFFJLYl0+HZkjkE61mC 84N8kqwOELmTM2BNiYr3ED+Z8XQfjMwpBm+kqHmX4NIcnASEPWJLan2EAgahGUlqgPJ8 lMnkkHgNiNEV7qpmXXH2SMBgTyvhLyifFrL8cUQj9s5FKxQKh0LfJ/DQ1EkZeHGbXzh0 UGsaL0HV52To5agFeQwjhE2SRzyS8nUVwydEE8sVTtS4xN8QGG3e6t/6AUtbv/1cKvsL yXhA== 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=/LGK2Ts85YWdDsJgUOexQLHXj6+Wo9SVkPt4TItkxNo=; fh=huj4wd9X+BQ826PS0NkTH5tJGcgGmco4vff0HSgOXbc=; b=GbgRRZ8UM/9HLLmdZFqLppVaa7Abxj5mO3p82GasAFsdUn0szmCSdjB5VPCjHI20Mr 7TxwOviJf+1i84akUpKYF9ida5C20+dKb8vDV7albo/d54FQjmlio/FAI3Czbs5Yuc3M lELpycuUS979uNi3BgeyMnmApJsoYMq22y31HjTcjw5xnUzBnAWCCg9/Wr31VrtDiR6d uIvUtrXJ9JspVWiNS2G8h6IzjKFbchJz2hebRNI3So5zEbNFh4vZb4NU6+Zx2LhR73Co qk1DltcmDqWhoI1wHqyePxDP5EF+qYMtT6I4X0nrddt7Pekr9GhdCVKjP0kmAXNKv53o bEmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="mRUt5zv/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47295-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47295-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXqKR/X86bNEaZDZomIcVFEcmFiOaV+TyTfD4ExZNVTVFJGFnGrt06kXOsP4IXaLnUdtIdx2wVCM+Q1avpJ4WBZZrehHA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n16-20020a170903111000b001d757bf025fsi10921439plh.231.2024.01.31.15.10.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 15:10:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47295-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="mRUt5zv/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47295-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47295-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 078E2296A34 for ; Wed, 31 Jan 2024 23:07:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87A9247F41; Wed, 31 Jan 2024 23:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mRUt5zv/" 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 83B8647773; Wed, 31 Jan 2024 23:02:52 +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=1706742172; cv=none; b=ECwNt9bDJbPmg2EOOK6Lo2sEv4Nm1/2OuR6euNTd1pBCUtx/arhHxcQnJ9N/bkWxEvA4fcOYxTSAsI85b75aWRpyQzSg1FINLA2ZYTJE4LjmM56OZGd8Xrq8O6uKLOgUrsB8xjUx7lje5uO7EFeRYYO0gmXwZ511zfMzE/NuWmM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706742172; c=relaxed/simple; bh=6lT/AJ7DI7EcIyd9sTjj002gtwJ758Oz0KnZq2omTSc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Kb6dki62sE0q/tugZxR6iXrQmAwODzHvZTIQswYph+vPp40faI4Ktx8fevsagYn2MRwIDSq9Jvisums3V+KPXMWUm2+jgMAE0ax/gJ3dLQRvvw/ZWFTxtoAO9HGgXHBA31c0eB9H53wuoIib0+CQjfduk93yU08ZUBFahqWLZA4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mRUt5zv/; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58ABBC43141; Wed, 31 Jan 2024 23:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706742172; bh=6lT/AJ7DI7EcIyd9sTjj002gtwJ758Oz0KnZq2omTSc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=mRUt5zv/kraGlqbTxQqaVL/bTh+i6dTpaDA78iwP0gYbEt2134w529lERRv2N2JeP q+Bw+eYnQGvxKrAD6bmt+T2fKnD+uanKifpJMvgQ9L0sncND2Bgw9KYfgJUeuK/NWU eWVTlzcFtCwbOYNtZHkmj4vcDFkTBAkBM73flRcTEnyvXrpf0gz/OLSKrySlWvKOfY U3nIZi8oZx1C6C7NBopDvUubate0vNBWaT2nKbC6LgSb+RzkcWjitAi2p/OKEp47Ox mrVJRhnVV3PAfwZl/nWXYvfoi5oD6/uWWlyf+COaSHmo0AkCeGaB0FNPU2jS90zjnp yMSzhcNX2wBPA== From: Jeff Layton Date: Wed, 31 Jan 2024 18:01:50 -0500 Subject: [PATCH v3 09/47] gfs2: convert to using new filelock helpers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240131-flsplit-v3-9-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=1735; i=jlayton@kernel.org; h=from:subject:message-id; bh=6lT/AJ7DI7EcIyd9sTjj002gtwJ758Oz0KnZq2omTSc=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlutFvJm0d1jiXUa8dmKAKx/rdNZx0AaqYhFOch 7fu7f0iAHGJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbrRbwAKCRAADmhBGVaC FTuYD/9u6c1S8nZFiijh2qT6BQlXdfQXeJFmCKu/GmfGttkXK7lIjFM0a3SOgEMvkviKfKyYDWw 2JCwlKaP2bYEuS52x+183j0KMdOMe0zpKF9bKbvQn+OVK1t2XDW7SJ1tyDUuPXckzN0+tWt6b7G UoqSySu+hkcFIDKAR3IDVcjjajSFC16iQkdplc1Offv3dA47viT6jMvYqLqqk4/EGrBDbIrfy5v uXds6Niams1hnA2hD0tmcVGHjwb4RLzp9Sr4Jp6GLo7KjbPN6nxAc+/ELFXjDvhzD3bXjwTKMBq vaEp7u9a4wTGddT5H7xfiMTrgPey2JiiOQV0q8ObEbs0Y5/OJ7gL/sAddzCcbYPMwlaGmbPO0gW Qbfjy50xeArmepuFt4M3jmZMmbHOQBLU1Omwxq1ukO/tGxaielwqy53IlI2p2lrnXJwT61tWqJj SrGVThxwxPZcNVQjaD38K6MgF6QbLXf21uSxl3rZBEVWC4oC4chXwGsu3adVIKVb7SZRYsfoZDk HdetieVeu1QLgfFk1Z2vHvHi/5Fu/qvy2a5F5DRYzbj+p4vtWRzZfrwXehk97wp0cAl8TYx580i doC26gg7e+dTbci3luI4qpG9WEwVYkDI9onu/hmEyt15URo/AaHyT0R8Uvo0vDxGXyif9Xx59u6 h2QgPHmliPZZfKQ== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789649364496713695 X-GMAIL-MSGID: 1789649364496713695 Convert to using the new file locking helper functions. Signed-off-by: Jeff Layton --- fs/gfs2/file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 992ca4effb50..6c25aea30f1b 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -1443,7 +1443,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) if (!(fl->fl_flags & FL_POSIX)) return -ENOLCK; if (gfs2_withdrawing_or_withdrawn(sdp)) { - if (fl->fl_type == F_UNLCK) + if (lock_is_unlock(fl)) locks_lock_file_wait(file, fl); return -EIO; } @@ -1451,7 +1451,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) return dlm_posix_cancel(ls->ls_dlm, ip->i_no_addr, file, fl); else if (IS_GETLK(cmd)) return dlm_posix_get(ls->ls_dlm, ip->i_no_addr, file, fl); - else if (fl->fl_type == F_UNLCK) + else if (lock_is_unlock(fl)) return dlm_posix_unlock(ls->ls_dlm, ip->i_no_addr, file, fl); else return dlm_posix_lock(ls->ls_dlm, ip->i_no_addr, file, cmd, fl); @@ -1483,7 +1483,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) int error = 0; int sleeptime; - state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; + state = (lock_is_write(fl)) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; flags = GL_EXACT | GL_NOPID; if (!IS_SETLKW(cmd)) flags |= LM_FLAG_TRY_1CB; @@ -1560,7 +1560,7 @@ static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl) if (!(fl->fl_flags & FL_FLOCK)) return -ENOLCK; - if (fl->fl_type == F_UNLCK) { + if (lock_is_unlock(fl)) { do_unflock(file, fl); return 0; } else {