From: hch <hch@lst.de>
To: Christian Brauner <brauner@kernel.org>
Cc: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
"axboe@kernel.dk" <axboe@kernel.dk>,
"djwong@kernel.org" <djwong@kernel.org>,
"ebiggers@google.com" <ebiggers@google.com>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
Xiao Ni <xni@redhat.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>
Subject: Re: [PATCH] fs: move the bdex_statx call to vfs_getattr_nosec
Date: Tue, 22 Apr 2025 16:15:05 +0200 [thread overview]
Message-ID: <20250422141505.GA25426@lst.de> (raw)
In-Reply-To: <20250422081736.GA674@lst.de>
Turns out this doesn't work. We used to have the request_mask, but it
got removed in 25fbcd62d2e1 ("bdev: use bdev_io_min() for statx block
size") so that stat can expose the block device min I/O size in
st_blkdev, and as the blksize doesn't have it's own request_mask flag
is hard to special case.
So maybe the better question is why devtmpfs even calls into
vfs_getattr? As far as I can tell handle_remove is only ever called on
the actual devtmpfs file system, so we don't need to go through the
VFS to query i_mode. i.e. the patch should also fix the issue. The
modify_change is probably not needed either, but for now I'm aiming
for the minimal fix.
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 6dd1a8860f1c..53fb0829eb7b 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -296,7 +296,7 @@ static int delete_path(const char *nodepath)
return err;
}
-static int dev_mynode(struct device *dev, struct inode *inode, struct kstat *stat)
+static int dev_mynode(struct device *dev, struct inode *inode)
{
/* did we create it */
if (inode->i_private != &thread)
@@ -304,13 +304,13 @@ static int dev_mynode(struct device *dev, struct inode *inode, struct kstat *sta
/* does the dev_t match */
if (is_blockdev(dev)) {
- if (!S_ISBLK(stat->mode))
+ if (!S_ISBLK(inode->i_mode))
return 0;
} else {
- if (!S_ISCHR(stat->mode))
+ if (!S_ISCHR(inode->i_mode))
return 0;
}
- if (stat->rdev != dev->devt)
+ if (inode->i_rdev != dev->devt)
return 0;
/* ours */
@@ -321,8 +321,7 @@ static int handle_remove(const char *nodename, struct device *dev)
{
struct path parent;
struct dentry *dentry;
- struct kstat stat;
- struct path p;
+ struct inode *inode;
int deleted = 0;
int err;
@@ -330,11 +329,8 @@ static int handle_remove(const char *nodename, struct device *dev)
if (IS_ERR(dentry))
return PTR_ERR(dentry);
- p.mnt = parent.mnt;
- p.dentry = dentry;
- err = vfs_getattr(&p, &stat, STATX_TYPE | STATX_MODE,
- AT_STATX_SYNC_AS_STAT);
- if (!err && dev_mynode(dev, d_inode(dentry), &stat)) {
+ inode = d_inode(dentry);
+ if (dev_mynode(dev, inode)) {
struct iattr newattrs;
/*
* before unlinking this node, reset permissions
@@ -342,7 +338,7 @@ static int handle_remove(const char *nodename, struct device *dev)
*/
newattrs.ia_uid = GLOBAL_ROOT_UID;
newattrs.ia_gid = GLOBAL_ROOT_GID;
- newattrs.ia_mode = stat.mode & ~0777;
+ newattrs.ia_mode = inode->i_mode & ~0777;
newattrs.ia_valid =
ATTR_UID|ATTR_GID|ATTR_MODE;
inode_lock(d_inode(dentry));
next prev parent reply other threads:[~2025-04-22 14:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-17 6:40 [PATCH] fs: move the bdex_statx call to vfs_getattr_nosec Christoph Hellwig
2025-04-17 8:01 ` Christian Brauner
2025-04-17 8:14 ` Christian Brauner
2025-04-17 16:20 ` Darrick J. Wong
2025-04-22 5:03 ` Shinichiro Kawasaki
2025-04-22 5:51 ` hch
2025-04-22 7:25 ` Christian Brauner
2025-04-22 7:27 ` hch
2025-04-22 8:15 ` Christian Brauner
2025-04-22 8:17 ` hch
2025-04-22 9:29 ` Christian Brauner
2025-04-22 14:15 ` hch [this message]
2025-04-22 15:35 ` Christian Brauner
2025-04-23 1:31 ` Shinichiro Kawasaki
2025-04-23 4:30 ` Jain, Ayush
2025-04-22 10:31 ` Shinichiro Kawasaki
2025-04-22 14:18 ` Heiko Carstens
[not found] ` <d6dc234d922d8beda65f2a1eed1e2de6a50c978f.camel@linux.ibm.com>
2025-04-25 13:39 ` Christoph Hellwig
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=20250422141505.GA25426@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=dakr@kernel.org \
--cc=djwong@kernel.org \
--cc=ebiggers@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=shinichiro.kawasaki@wdc.com \
--cc=viro@zeniv.linux.org.uk \
--cc=xni@redhat.com \
/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.