From patchwork Wed Jan 31 23:02:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 195093 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp108676dyc; Wed, 31 Jan 2024 16:12:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1ofywPrU1NfENVI2DS9jJ/r7M3si7ER4fJ/ns2KsO46/EeJM+IZQN+q9TVpBMMheI7YX2 X-Received: by 2002:a05:6a20:4e06:b0:196:6d16:6db4 with SMTP id gk6-20020a056a204e0600b001966d166db4mr540919pzb.53.1706746361661; Wed, 31 Jan 2024 16:12:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706746361; cv=pass; d=google.com; s=arc-20160816; b=NJZGDsmDBA0ZuHz3KRi7TgHJ6dHTQNXgTwdrkaqKXiWcbKjJqqFzBv6+/7fwakWSIi YlNKPtDUSpiHyxzI3McD6wYApPqlmGet9irFTc0IrWQhNP+1NUN4hbRlishpP55LzY4M YSY/UOr471GQPoyvERGE/kAzOhLx0ausw8bTI1PjRUcVb4R7aUlS14Wje2hcO3pFUKJZ 3RCcegFMD2DxzMjGyto0BGUomKkBxcPNsATdTWVpiJsFION8lFNl+tR7onHdZarJayaM rkeQMRKqz7k0WMcQTHR+7cOQlEjvsq4bUYavHA+DjOnlU677aCeZ6H0rJjkkwdI0Kyq2 6tkA== 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=++mO/inEmcQX4SBT5wkN1uyeryA9crAcMxVfmVxU0S8=; fh=kR5xLpewXeuEEs9dwV4NTHLu7QFY/TwOTbE1aS6nEOM=; b=kIeWPL5wPlM/C6Q8bQiHleS8t+jb2b+FSClXtkpppLhkV0SMRQ10e1AhCwuSct4nn4 3b+PjC1J7imGJaU9g8xIrbnYLIEWwrCBGA9rDqZ1zqoOZTQ30DHjP5DZEyFtpXCsjOwU BVzxuDzw4ItNvpfd27CcCFCWwIPhzbDAXiPw25Qa3CvfP93F+trVw2IxrgsvvWtZvL4o 8U3BHYaIUl8Ex23dQ5hexwHYn9OllXVjKQgvM78yX2RsOfojH97EKMk8wZSHZJYH1lgQ EoUEMhJCq5WH4MzqqMnKptIrT3eBwJMRxHmmkqBv1dVgk4yb98kD21ob1hK18/azXRUt heuQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EzP645gD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47326-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47326-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCW1ULKDbiKAyRfZfuVtHaCejQSJmeIRWhspyFV07rsoaZXxsGQqoq1Vk+b6O9r/+qg4ICnSuNZZwHoDLQ2nhtoLJgXplQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y2-20020a17090a86c200b00295cd8cf1fasi2400395pjv.178.2024.01.31.16.12.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 16:12:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47326-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EzP645gD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47326-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47326-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C5F95B33546 for ; Wed, 31 Jan 2024 23:20:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B1B2C14A4EB; Wed, 31 Jan 2024 23:04:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EzP645gD" 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 B33863A8F2; Wed, 31 Jan 2024 23:04:51 +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=1706742291; cv=none; b=k0u4Z+Ht0KdHIRe0EXNEzWtIvqXR4Gq4rvSI7vAObRea1W6hAkwhDvS2WBEhBzy/V4r2VK9CE7FooUMad44TkQgvpEkngwWhomgxybESW/L6bnT++VyGfxRdhTnOS8p6tgts61ggpNeaDRU0TON6x39k844CW8eza4UbPLiIlyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706742291; c=relaxed/simple; bh=606xHOV7REs/CUmLZVKJCoqRw4w+gjwX2JuKeDHEpfs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RiqvtKuAWpN1UuGYPz8T42b5TXKq/QZn+MNa5mriruv/i9JaOTxX5CCN9FXnJp589hScFh+8v+cWAk3ZcpJ4HvOxgBfVbTC8JouAU8GghgGahgO4O4IogCvaRqu+xp66Fa+l6eTNNawrw27r0PzCuieuWdkopJrihX1Fd5I6Gc8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EzP645gD; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 738E9C43609; Wed, 31 Jan 2024 23:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706742291; bh=606xHOV7REs/CUmLZVKJCoqRw4w+gjwX2JuKeDHEpfs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EzP645gDJBv1zggBtj+hRyEisysLv0Pa+ri4P8BUe6hP92qCWl0sTTLLHfw20CG57 joB9diNPbQINssmHU3XR0tsjQ/dpET4zTrP2RzP961PqvokoWHNBds5SZFmMpHhwMY NhSLMjov3RK7TCYJNS0RBrMyx083IYMZqC2PLY0qYDYHjVTxfBYBYZblr7QC9uf9Sy EIOPZhh6k+7DIPkm3VAxDqjWkQz6JUbxaKeXRDwDP7PVjhQ2QGVtau7iUklgBW+OCm mkYo5ibk2xjvWRtdFUZIZG/GFSJH+0q9KliHV4cgO3d1BnAiQNZlIcbg6CWhS5ZM47 xux7U4htrBF8Q== From: Jeff Layton Date: Wed, 31 Jan 2024 18:02:20 -0500 Subject: [PATCH v3 39/47] fuse: adapt to breakup of struct file_lock 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-39-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=2506; i=jlayton@kernel.org; h=from:subject:message-id; bh=606xHOV7REs/CUmLZVKJCoqRw4w+gjwX2JuKeDHEpfs=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlutFzhpKXOO+ReJrR0/Wtxd47aXLz+odJTpqdJ XgznpGWy26JAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbrRcwAKCRAADmhBGVaC FW4AD/0d6m0tKbhRrgZOQYosgQpUX6OwEpIrT/cxfgJJ5ETeRG3V4fuVoUY9AIL77bDZ9399X8+ k1mriUxlAXGv1dgdx2mSLd3dSrV0pvmc7zio5NIO7fPcjmhP0NoddT36cTCYoBPtT6tPWwQGbyw QSnydNxkAUWqtymkYNLwgzGYTjYOuv2dX9e0IiIlaztHb2ntAePN+CPmyulR9EvN1R6uMwsIkvJ cdIhQefFhiDRLacB0N0TrfrF9JZt2yFtr2Ua1CTYsubzW67/qMyxsfRHiThJ+/PXqtc52Vb+TVY /A1l+oHmP8OUWsVEl6hfJnK4eEDD8l3RuJjAou35GeoXcqPI2+MWSAaw4NseBegDgAr/Ps4pP7t PmZcpXUEJDE2oXJ5iQ9Z17EKK1skeKgLelYOcHvyiNhxEEPaJngHhzHBQPoYIDoZr5u79sLJqoD rapDoEuNFf6Hnuu+8F7DjEguJZEAg16deRjZhO05R9s0cFW+9mNRPMs0a11aOWFMRmOC9C/34oY vbgLxCBVd6NSY26dl4lraeIW2gjEO8EtpPsAlEZqDVhILobITpVMW0e7OJgvWdDl+GBblKhTdv+ jIMiMYxs6U9B0o5s7H6LrtFMpq0w6gS3edNY2FT08hkXaRij/pZb1fjZbtLa+5vTw2I/FLAO84a fTX5emi7Aj9eN4w== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789653272991528418 X-GMAIL-MSGID: 1789653272991528418 Most of the existing APIs have remained the same, but subsystems that access file_lock fields directly need to reach into struct file_lock_core now. Signed-off-by: Jeff Layton --- fs/fuse/file.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 2757870ee6ac..c007b0f0c3a7 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -18,7 +18,6 @@ #include #include #include -#define _NEED_FILE_LOCK_FIELD_MACROS #include #include @@ -2510,14 +2509,14 @@ static int convert_fuse_file_lock(struct fuse_conn *fc, * translate it into the caller's pid namespace. */ rcu_read_lock(); - fl->fl_pid = pid_nr_ns(find_pid_ns(ffl->pid, fc->pid_ns), &init_pid_ns); + fl->c.flc_pid = pid_nr_ns(find_pid_ns(ffl->pid, fc->pid_ns), &init_pid_ns); rcu_read_unlock(); break; default: return -EIO; } - fl->fl_type = ffl->type; + fl->c.flc_type = ffl->type; return 0; } @@ -2531,10 +2530,10 @@ static void fuse_lk_fill(struct fuse_args *args, struct file *file, memset(inarg, 0, sizeof(*inarg)); inarg->fh = ff->fh; - inarg->owner = fuse_lock_owner_id(fc, fl->fl_owner); + inarg->owner = fuse_lock_owner_id(fc, fl->c.flc_owner); inarg->lk.start = fl->fl_start; inarg->lk.end = fl->fl_end; - inarg->lk.type = fl->fl_type; + inarg->lk.type = fl->c.flc_type; inarg->lk.pid = pid; if (flock) inarg->lk_flags |= FUSE_LK_FLOCK; @@ -2571,8 +2570,8 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock) struct fuse_mount *fm = get_fuse_mount(inode); FUSE_ARGS(args); struct fuse_lk_in inarg; - int opcode = (fl->fl_flags & FL_SLEEP) ? FUSE_SETLKW : FUSE_SETLK; - struct pid *pid = fl->fl_type != F_UNLCK ? task_tgid(current) : NULL; + int opcode = (fl->c.flc_flags & FL_SLEEP) ? FUSE_SETLKW : FUSE_SETLK; + struct pid *pid = fl->c.flc_type != F_UNLCK ? task_tgid(current) : NULL; pid_t pid_nr = pid_nr_ns(pid, fm->fc->pid_ns); int err; @@ -2582,7 +2581,7 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock) } /* Unlock on close is handled by the flush method */ - if ((fl->fl_flags & FL_CLOSE_POSIX) == FL_CLOSE_POSIX) + if ((fl->c.flc_flags & FL_CLOSE_POSIX) == FL_CLOSE_POSIX) return 0; fuse_lk_fill(&args, file, fl, opcode, pid_nr, flock, &inarg);