From: David Howells <dhowells@redhat.com>
To: Christian Brauner <christian@brauner.io>,
Jeff Layton <jlayton@kernel.org>,
Gao Xiang <hsiangkao@linux.alibaba.com>,
Dominique Martinet <asmadeus@codewreck.org>
Cc: David Howells <dhowells@redhat.com>,
Steve French <smfrench@gmail.com>,
Matthew Wilcox <willy@infradead.org>,
Marc Dionne <marc.dionne@auristor.com>,
Paulo Alcantara <pc@manguebit.com>,
Shyam Prasad N <sprasad@microsoft.com>,
Tom Talpey <tom@talpey.com>,
Eric Van Hensbergen <ericvh@kernel.org>,
Ilya Dryomov <idryomov@gmail.com>,
linux-cachefs@redhat.com, linux-afs@lists.infradead.org,
linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org,
ceph-devel@vger.kernel.org, v9fs@lists.linux.dev,
linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Latchesar Ionkov <lucho@ionkov.net>,
Christian Schoenebeck <linux_oss@crudebyte.com>
Subject: [PATCH 3/5] 9p: Do a couple of cleanups
Date: Wed, 3 Jan 2024 14:59:27 +0000 [thread overview]
Message-ID: <20240103145935.384404-4-dhowells@redhat.com> (raw)
In-Reply-To: <20240103145935.384404-1-dhowells@redhat.com>
Do a couple of cleanups to 9p:
(1) Remove a couple of unused variables.
(2) Turn a BUG_ON() into a warning, consolidate with another warning and
make the warning message include the inode number rather than
whatever's in i_private (which will get hashed anyway).
Suggested-by: Dominique Martinet <asmadeus@codewreck.org>
Link: https://lore.kernel.org/r/ZZULNQAZ0n0WQv7p@codewreck.org/
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Eric Van Hensbergen <ericvh@kernel.org>
cc: Latchesar Ionkov <lucho@ionkov.net>
cc: Christian Schoenebeck <linux_oss@crudebyte.com>
cc: v9fs@lists.linux.dev
cc: linux-cachefs@redhat.com
cc: linux-fsdevel@vger.kernel.org
---
fs/9p/vfs_addr.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index d8fb407189a0..f7f83eec3bcc 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -28,8 +28,6 @@
static void v9fs_upload_to_server(struct netfs_io_subrequest *subreq)
{
- struct inode *inode = subreq->rreq->inode;
- struct v9fs_inode __maybe_unused *v9inode = V9FS_I(inode);
struct p9_fid *fid = subreq->rreq->netfs_priv;
int err;
@@ -98,15 +96,13 @@ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file)
if (file) {
fid = file->private_data;
- BUG_ON(!fid);
+ if (!fid)
+ goto no_fid;
p9_fid_get(fid);
} else {
fid = v9fs_fid_find_inode(rreq->inode, writing, INVALID_UID, true);
- if (!fid) {
- WARN_ONCE(1, "folio expected an open fid inode->i_private=%p\n",
- rreq->inode->i_private);
- return -EINVAL;
- }
+ if (!fid)
+ goto no_fid;
}
/* we might need to read from a fid that was opened write-only
@@ -115,6 +111,11 @@ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file)
WARN_ON(rreq->origin == NETFS_READ_FOR_WRITE && !(fid->mode & P9_ORDWR));
rreq->netfs_priv = fid;
return 0;
+
+no_fid:
+ WARN_ONCE(1, "folio expected an open fid inode->i_ino=%lx\n",
+ rreq->inode->i_ino);
+ return -EINVAL;
}
/**
WARNING: multiple messages have this Message-ID (diff)
From: David Howells <dhowells@redhat.com>
To: Christian Brauner <christian@brauner.io>,
Jeff Layton <jlayton@kernel.org>,
Gao Xiang <hsiangkao@linux.alibaba.com>,
Dominique Martinet <asmadeus@codewreck.org>
Cc: Latchesar Ionkov <lucho@ionkov.net>,
Christian Schoenebeck <linux_oss@crudebyte.com>,
David Howells <dhowells@redhat.com>,
linux-mm@kvack.org, Marc Dionne <marc.dionne@auristor.com>,
linux-afs@lists.infradead.org, Paulo Alcantara <pc@manguebit.com>,
linux-cifs@vger.kernel.org, Matthew Wilcox <willy@infradead.org>,
Steve French <smfrench@gmail.com>,
linux-cachefs@redhat.com, Ilya Dryomov <idryomov@gmail.com>,
Shyam Prasad N <sprasad@microsoft.com>,
Tom Talpey <tom@talpey.com>,
ceph-devel@vger.kernel.org,
Eric Van Hensbergen <ericvh@kernel.org>,
linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
v9fs@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org
Subject: [PATCH 3/5] 9p: Do a couple of cleanups
Date: Wed, 3 Jan 2024 14:59:27 +0000 [thread overview]
Message-ID: <20240103145935.384404-4-dhowells@redhat.com> (raw)
In-Reply-To: <20240103145935.384404-1-dhowells@redhat.com>
Do a couple of cleanups to 9p:
(1) Remove a couple of unused variables.
(2) Turn a BUG_ON() into a warning, consolidate with another warning and
make the warning message include the inode number rather than
whatever's in i_private (which will get hashed anyway).
Suggested-by: Dominique Martinet <asmadeus@codewreck.org>
Link: https://lore.kernel.org/r/ZZULNQAZ0n0WQv7p@codewreck.org/
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Eric Van Hensbergen <ericvh@kernel.org>
cc: Latchesar Ionkov <lucho@ionkov.net>
cc: Christian Schoenebeck <linux_oss@crudebyte.com>
cc: v9fs@lists.linux.dev
cc: linux-cachefs@redhat.com
cc: linux-fsdevel@vger.kernel.org
---
fs/9p/vfs_addr.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index d8fb407189a0..f7f83eec3bcc 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -28,8 +28,6 @@
static void v9fs_upload_to_server(struct netfs_io_subrequest *subreq)
{
- struct inode *inode = subreq->rreq->inode;
- struct v9fs_inode __maybe_unused *v9inode = V9FS_I(inode);
struct p9_fid *fid = subreq->rreq->netfs_priv;
int err;
@@ -98,15 +96,13 @@ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file)
if (file) {
fid = file->private_data;
- BUG_ON(!fid);
+ if (!fid)
+ goto no_fid;
p9_fid_get(fid);
} else {
fid = v9fs_fid_find_inode(rreq->inode, writing, INVALID_UID, true);
- if (!fid) {
- WARN_ONCE(1, "folio expected an open fid inode->i_private=%p\n",
- rreq->inode->i_private);
- return -EINVAL;
- }
+ if (!fid)
+ goto no_fid;
}
/* we might need to read from a fid that was opened write-only
@@ -115,6 +111,11 @@ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file)
WARN_ON(rreq->origin == NETFS_READ_FOR_WRITE && !(fid->mode & P9_ORDWR));
rreq->netfs_priv = fid;
return 0;
+
+no_fid:
+ WARN_ONCE(1, "folio expected an open fid inode->i_ino=%lx\n",
+ rreq->inode->i_ino);
+ return -EINVAL;
}
/**
next prev parent reply other threads:[~2024-01-03 15:00 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-03 14:59 [PATCH 0/5] netfs, cachefiles, 9p: Additional patches David Howells
2024-01-03 14:59 ` David Howells
2024-01-03 14:59 ` [PATCH 1/5] cachefiles: Fix __cachefiles_prepare_write() David Howells
2024-01-03 14:59 ` David Howells
2024-01-07 16:09 ` Simon Horman
2024-01-07 16:09 ` Simon Horman
2024-01-08 22:31 ` David Howells
2024-01-08 22:31 ` David Howells
2024-01-09 8:32 ` Simon Horman
2024-01-09 8:32 ` Simon Horman
2024-01-03 14:59 ` [PATCH 2/5] 9p: Fix initialisation of netfs_inode for 9p David Howells
2024-01-03 14:59 ` David Howells
2024-01-03 14:59 ` David Howells [this message]
2024-01-03 14:59 ` [PATCH 3/5] 9p: Do a couple of cleanups David Howells
2024-01-03 19:45 ` Dominique Martinet
2024-01-03 19:45 ` Dominique Martinet
2024-01-03 14:59 ` [PATCH 4/5] 9p: Always update remote_i_size in stat2inode David Howells
2024-01-03 14:59 ` David Howells
2024-01-03 19:42 ` Dominique Martinet
2024-01-03 19:42 ` Dominique Martinet
2024-01-03 14:59 ` [PATCH 5/5] 9p: Use length of data written to the server in preference to error David Howells
2024-01-03 14:59 ` David Howells
2024-01-03 19:46 ` Dominique Martinet
2024-01-03 19:46 ` Dominique Martinet
2024-01-03 15:47 ` [PATCH 6/5] netfs: Rearrange netfs_io_subrequest to put request pointer first David Howells
2024-01-03 15:47 ` David Howells
2024-01-03 21:15 ` [PATCH 7/5] netfs: Fix proc/fs/fscache symlink to point to "netfs" not "../netfs" David Howells
2024-01-03 21:15 ` David Howells
2024-01-05 10:33 ` [PATCH 0/5] netfs, cachefiles, 9p: Additional patches Christian Brauner
2024-01-05 10:33 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240103145935.384404-4-dhowells@redhat.com \
--to=dhowells@redhat.com \
--cc=asmadeus@codewreck.org \
--cc=ceph-devel@vger.kernel.org \
--cc=christian@brauner.io \
--cc=ericvh@kernel.org \
--cc=hsiangkao@linux.alibaba.com \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-cachefs@redhat.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=marc.dionne@auristor.com \
--cc=netdev@vger.kernel.org \
--cc=pc@manguebit.com \
--cc=smfrench@gmail.com \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.com \
--cc=v9fs@lists.linux.dev \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.