Re: [PATCH v3 01/18] vfs: add fileattr ops
From: Miklos Szeredi
Date: Mon Mar 29 2021 - 04:19:09 EST
On Sun, Mar 28, 2021 at 8:08 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, Mar 25, 2021 at 08:37:38PM +0100, Miklos Szeredi wrote:
>
> > +int vfs_fileattr_get(struct dentry *dentry, struct fileattr *fa)
> > +{
> > + struct inode *inode = d_inode(dentry);
> > +
> > + if (d_is_special(dentry))
> > + return -ENOTTY;
>
> FWIW - why? For uses via ioctl() you simply won't get there with
> device nodes et.al. - they have file_operations of their own.
Yes it will: this is called by the vfs, not the filesystem.
> If we add syscall(s) for getting/setting those, there's no reason
> for e.g. a device node not to have those attributes...
Fair enough, but I guess filesystems will need to explicitly enable
support for these attributes on special files.
We can move that check inside filesystems now, or we can move it
later, when actually needed. Which do you prefer? (only a couple of
filesystems are affected, IIRC, which don't have separate i_ops for
regular and special files).
Thanks,
Miklos