From: Christian Brauner <brauner@kernel.org>
To: Andrey Albershteyn <aalbersh@redhat.com>
Cc: "Darrick J. Wong" <djwong@kernel.org>,
linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org,
Jan Kara <jack@suse.cz>, Jiri Slaby <jirislaby@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Andrey Albershteyn <aalbersh@kernel.org>
Subject: Re: [PATCH 2/2] fs: return EOPNOTSUPP from file_setattr/file_getattr syscalls
Date: Fri, 10 Oct 2025 13:45:13 +0200 [thread overview]
Message-ID: <20251010-schachfiguren-blutkonserven-9707ac22a0e2@brauner> (raw)
In-Reply-To: <q6phvrrl2fumjwwd66d5glauch76uca4rr5pkvl2dwaxzx62bm@sjcixwa7r6r5>
On Fri, Oct 10, 2025 at 12:05:04PM +0200, Andrey Albershteyn wrote:
> On 2025-10-09 10:20:41, Darrick J. Wong wrote:
> > On Wed, Oct 08, 2025 at 02:44:18PM +0200, Andrey Albershteyn wrote:
> > > These syscalls call to vfs_fileattr_get/set functions which return
> > > ENOIOCTLCMD if filesystem doesn't support setting file attribute on an
> > > inode. For syscalls EOPNOTSUPP would be more appropriate return error.
> > >
> > > Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
> > > ---
> > > fs/file_attr.c | 4 ++++
> > > 1 file changed, 4 insertions(+)
> > >
> > > diff --git a/fs/file_attr.c b/fs/file_attr.c
> > > index 460b2dd21a85..5e3e2aba97b5 100644
> > > --- a/fs/file_attr.c
> > > +++ b/fs/file_attr.c
> > > @@ -416,6 +416,8 @@ SYSCALL_DEFINE5(file_getattr, int, dfd, const char __user *, filename,
> > > }
> > >
> > > error = vfs_fileattr_get(filepath.dentry, &fa);
> > > + if (error == -ENOIOCTLCMD)
> >
> > Hrm. Back in 6.17, XFS would return ENOTTY if you called ->fileattr_get
> > on a special file:
> >
> > int
> > xfs_fileattr_get(
> > struct dentry *dentry,
> > struct file_kattr *fa)
> > {
> > struct xfs_inode *ip = XFS_I(d_inode(dentry));
> >
> > if (d_is_special(dentry))
> > return -ENOTTY;
> > ...
> > }
> >
> > Given that there are other fileattr_[gs]et implementations out there
> > that might return ENOTTY (e.g. fuse servers and other externally
> > maintained filesystems), I think both syscall functions need to check
> > for that as well:
> >
> > if (error == -ENOIOCTLCMD || error == -ENOTTY)
> > return -EOPNOTSUPP;
>
> Make sense (looks like ubifs, jfs and gfs2 also return ENOTTY for
> special files), I haven't found ENOTTY being used for anything else
> there
I'm folding this in.
next prev parent reply other threads:[~2025-10-10 11:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-08 12:44 [PATCH 0/2] Fix to EOPNOTSUPP double conversion in ioctl_setflags() Andrey Albershteyn
2025-10-08 12:44 ` [PATCH 1/2] Revert "fs: make vfs_fileattr_[get|set] return -EOPNOTSUPP" Andrey Albershteyn
2025-10-08 12:44 ` [PATCH 2/2] fs: return EOPNOTSUPP from file_setattr/file_getattr syscalls Andrey Albershteyn
2025-10-08 13:23 ` Arnd Bergmann
2025-10-08 13:30 ` Jan Kara
2025-10-09 17:20 ` Darrick J. Wong
2025-10-10 10:05 ` Andrey Albershteyn
2025-10-10 11:45 ` Christian Brauner [this message]
2025-10-10 11:47 ` [PATCH 0/2] Fix to EOPNOTSUPP double conversion in ioctl_setflags() 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=20251010-schachfiguren-blutkonserven-9707ac22a0e2@brauner \
--to=brauner@kernel.org \
--cc=aalbersh@kernel.org \
--cc=aalbersh@redhat.com \
--cc=arnd@arndb.de \
--cc=djwong@kernel.org \
--cc=jack@suse.cz \
--cc=jirislaby@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox