Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1971029rdb; Wed, 31 Jan 2024 15:18:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGuUm9/45J+79w91OSnEGtSqo6yaepwGxHkRTC+vLbb/lnov0L29KyS6xz+n+wOYUK/dbGp X-Received: by 2002:ac2:4d10:0:b0:511:1dff:f605 with SMTP id r16-20020ac24d10000000b005111dfff605mr496531lfi.46.1706743126551; Wed, 31 Jan 2024 15:18:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706743126; cv=pass; d=google.com; s=arc-20160816; b=f8gMpq8D+QF9/GefPCplHlmexjjNLRBn8/OceW8qZFVitCZvzvpPDwmLfs0Q93sXCd /t2xrnGm0EHSLgrrWsT6rSmf/im6sHAaZB7ba2t+4z6JmGQc8TZ2+cYHPafzZc8ETPQi Wahg06PmXZDsLhaQXaR7OXJImETtWAjrwKXYzqY6+u/zTzaLM+6eaNbAU2LETUXcIbsR 2vIv2/3qUhwUl+UljP/zWYNBPP0ALgLYceKNArRrySDfTLZU8MeF0MzOfHMVPgoMRac6 tbDh3c/MHT0mehasmrHXwM+z6t96M3ri8LK/8ky+m3I9Dqtt1n7QaSAw2SiRkFMbcGMP LYDw== 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=96yANhp+bOfpkdgd1KhUEB4p8ZTW2FddSR1eeSl4fn4=; fh=FtDdvjeh6hcM9JD9q6d4Ti6GHMHbq5jMORpqdi2uRR0=; b=g469wp2AWFBHELWa5Lj6VnThj5d8WnfYBv4F692hUoBsRN5VFPK9oi35vx0CtWk4lW fCkFOooOihVqcmErvulCEZ+wI4rr25MRYkCoLkVQ1i2JqgiCqD5e1CUdTyTOvrvzXdqk ehJwWlp/224sVXhCoGrD6WcBmE6Q+7WAC1YPAs99mYUEPIlfo1NZJLHSbxlxFp7+3O34 gh0DTAk2EaHMCTQhyCK1DMB1fAS7R7tr/GZY0Zgu8Ar+vjYxR0Y+fIHcFCcfFzupcjXt LFzjeeYgl39s58nSwhBj931vUmpNG1VBgMZi4Zg4AmVwPBTu935w9txNQOqQgsYb1ZHq Woyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CQ2yxmgC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47321-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47321-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCWj5SmCwXakt19XDi7RhIc7qcElEBGUCX/P1ClsVI5dNX92LzkLIsN1gmu7YwOH4vcliG2aA6meqC8hhyhY6LCsVqgMgSyFWXje1wRdrA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j30-20020a508a9e000000b0055ef4a779dfsi3646505edj.463.2024.01.31.15.18.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 15:18:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47321-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CQ2yxmgC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47321-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47321-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 3141E1F27DBE for ; Wed, 31 Jan 2024 23:18:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A35471474DA; Wed, 31 Jan 2024 23:04:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CQ2yxmgC" 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 7D8831474B6; Wed, 31 Jan 2024 23:04:31 +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=1706742271; cv=none; b=pcU6kg0OIfZOpaRlY6yMH0f1Slr32onBABjFpKQStPm+vzqw7E4+Xjh8Jh68DivpphG4xqwD8MquecUs3UyIQxZsnWBMfIE7pBPoVvoSKZdg2xateWLU2UigM60JrFjS05jxtYuz/J7eXRFKN0Ivy1Owgj7W+wIU0QIvuvLQjUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706742271; c=relaxed/simple; bh=lt+oKLJUC48gDmjw1y21ssCmdJC4YA8AHvCegy98kEY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=n0369fZysez4eBH0YeNTcEnJq5VXADq3NCSR3Q10mAvvl2PcJlEEGODK7s9ggK3xSsvcMKNrSoR7O9KBreELv9aSaXbFKcmhi/8ssKSrCCQLdzF2Xn8K2/G708e2y5C4iAvBmU1D0sGZ+FRq9jfPdGM1hCSlFhTuKyPp1IQaI1Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CQ2yxmgC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AA4FC43609; Wed, 31 Jan 2024 23:04:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706742271; bh=lt+oKLJUC48gDmjw1y21ssCmdJC4YA8AHvCegy98kEY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=CQ2yxmgC28107Kau7/ccyZGZRGK5iUG+YZPwKedOd1g3VeyM/MCegE2d94WDhS8BJ 1jWsaQgJr1RDKrGASU/V1OI9FaZEFGz0C7pAp+SROGBT7OHoZC5K343veTcNwfVNUv li5qQlgOqi3kno+ik7DOFFXHF/HBpH6Xnqz6bWeMXM0GGSt1soUq0SIyksv9CQnNUz fEBleUU197/Roj1kwRNRUzLAfxEtxYO6CY1h7WUOCk1toaotkBxhQndt+RbQxrxlIa F3fP7a6tm6c6KVkvKglxnKZtmnK1hXaJj5upbBmKdy5E2jb5UfW0uKRP57115+GWIS TsYdZI6gwND5A== From: Jeff Layton Date: Wed, 31 Jan 2024 18:02:15 -0500 Subject: [PATCH v3 34/47] 9p: 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240131-flsplit-v3-34-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=5390; i=jlayton@kernel.org; h=from:subject:message-id; bh=lt+oKLJUC48gDmjw1y21ssCmdJC4YA8AHvCegy98kEY=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBlutFyepmoy/WJ4nMuHI/1auaqF0xE3bBNBZQeI IEYB/X2x5mJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZbrRcgAKCRAADmhBGVaC FQHJEACqIdAaO+PcmXbqT2RlGQptXethNxFqqJ5jHncN3XRhwkl3ISe2vxiPtVXfgUMXsXvtg5Q Xx0U4y7KVlRpgmjDEq6tYZieyOFCZfZQt2dmXfP2w45jxhKjzchv6dAK9n02dtnp0/BJKQ/33aw 8IhLaOUtn989ETCwSVryLxBZqfxgM0PgXGsXUH5aznuzHZ02EeuO5YWvxKd778ZFaJpD2GpRu1u l+baoDm9uXK62x/wuaMbSB/AG5gaNDgEK8HBxqz0zfmlPk5OCsdqTdk0oJJH+WISUOrrIKbRFxK inxDG0lf9fryuHjCK/AJ/6RvXpaU3U7wlt3ofFm9AiLUw87zNBJ/oclk6zAJqExCcYmGxz/vfJr JrtCuxwds3pt8DT67CduU0b/Q+lVz+P6PCbGLqxHTpSdNCtoOTu/rac2vskwCnanlNLs9phHeMg JM6voFU+G7d0ABYjJkVkp8vZMmuCp5SXGmlkUtdSo5uIxOlRo7oybqmb/4Xt7JKFfrqpGeyNOru 22IivsuLub37ZpVxrHEdwBsQyJtm4wDPl3oNy14HRVg2SIFQ3EiL+CIatXm91Y/cHfR8YGcNa6M pzkjArY9qTdMS8zm7IfwJ5aE3VJl2702WV2NdD0XReSznaY8EKFRYb57bKbZhKedj1ZOLMFphdC J3gJmxUtygqaSvw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 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/9p/vfs_file.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index a1dabcf73380..abdbbaee5184 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -9,7 +9,6 @@ #include #include #include -#define _NEED_FILE_LOCK_FIELD_MACROS #include #include #include @@ -108,7 +107,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl) p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl); - if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { + if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->c.flc_type != F_UNLCK) { filemap_write_and_wait(inode->i_mapping); invalidate_mapping_pages(&inode->i_data, 0, -1); } @@ -127,7 +126,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) fid = filp->private_data; BUG_ON(fid == NULL); - BUG_ON((fl->fl_flags & FL_POSIX) != FL_POSIX); + BUG_ON((fl->c.flc_flags & FL_POSIX) != FL_POSIX); res = locks_lock_file_wait(filp, fl); if (res < 0) @@ -136,7 +135,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) /* convert posix lock to p9 tlock args */ memset(&flock, 0, sizeof(flock)); /* map the lock type */ - switch (fl->fl_type) { + switch (fl->c.flc_type) { case F_RDLCK: flock.type = P9_LOCK_TYPE_RDLCK; break; @@ -152,7 +151,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) flock.length = 0; else flock.length = fl->fl_end - fl->fl_start + 1; - flock.proc_id = fl->fl_pid; + flock.proc_id = fl->c.flc_pid; flock.client_id = fid->clnt->name; if (IS_SETLKW(cmd)) flock.flags = P9_LOCK_FLAGS_BLOCK; @@ -207,13 +206,13 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) * incase server returned error for lock request, revert * it locally */ - if (res < 0 && fl->fl_type != F_UNLCK) { - unsigned char type = fl->fl_type; + if (res < 0 && fl->c.flc_type != F_UNLCK) { + unsigned char type = fl->c.flc_type; - fl->fl_type = F_UNLCK; + fl->c.flc_type = F_UNLCK; /* Even if this fails we want to return the remote error */ locks_lock_file_wait(filp, fl); - fl->fl_type = type; + fl->c.flc_type = type; } if (flock.client_id != fid->clnt->name) kfree(flock.client_id); @@ -235,7 +234,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) * if we have a conflicting lock locally, no need to validate * with server */ - if (fl->fl_type != F_UNLCK) + if (fl->c.flc_type != F_UNLCK) return res; /* convert posix lock to p9 tgetlock args */ @@ -246,7 +245,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) glock.length = 0; else glock.length = fl->fl_end - fl->fl_start + 1; - glock.proc_id = fl->fl_pid; + glock.proc_id = fl->c.flc_pid; glock.client_id = fid->clnt->name; res = p9_client_getlock_dotl(fid, &glock); @@ -255,13 +254,13 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) /* map 9p lock type to os lock type */ switch (glock.type) { case P9_LOCK_TYPE_RDLCK: - fl->fl_type = F_RDLCK; + fl->c.flc_type = F_RDLCK; break; case P9_LOCK_TYPE_WRLCK: - fl->fl_type = F_WRLCK; + fl->c.flc_type = F_WRLCK; break; case P9_LOCK_TYPE_UNLCK: - fl->fl_type = F_UNLCK; + fl->c.flc_type = F_UNLCK; break; } if (glock.type != P9_LOCK_TYPE_UNLCK) { @@ -270,7 +269,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) fl->fl_end = OFFSET_MAX; else fl->fl_end = glock.start + glock.length - 1; - fl->fl_pid = -glock.proc_id; + fl->c.flc_pid = -glock.proc_id; } out: if (glock.client_id != fid->clnt->name) @@ -294,7 +293,7 @@ static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl) p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %pD\n", filp, cmd, fl, filp); - if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { + if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->c.flc_type != F_UNLCK) { filemap_write_and_wait(inode->i_mapping); invalidate_mapping_pages(&inode->i_data, 0, -1); } @@ -325,16 +324,16 @@ static int v9fs_file_flock_dotl(struct file *filp, int cmd, p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %pD\n", filp, cmd, fl, filp); - if (!(fl->fl_flags & FL_FLOCK)) + if (!(fl->c.flc_flags & FL_FLOCK)) goto out_err; - if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { + if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->c.flc_type != F_UNLCK) { filemap_write_and_wait(inode->i_mapping); invalidate_mapping_pages(&inode->i_data, 0, -1); } /* Convert flock to posix lock */ - fl->fl_flags |= FL_POSIX; - fl->fl_flags ^= FL_FLOCK; + fl->c.flc_flags |= FL_POSIX; + fl->c.flc_flags ^= FL_FLOCK; if (IS_SETLK(cmd) | IS_SETLKW(cmd)) ret = v9fs_file_do_lock(filp, cmd, fl); -- 2.43.0