Thread (52 messages) 52 messages, 8 authors, 2025-10-07

Re: [PATCH v6 4/6] fs: make vfs_fileattr_[get|set] return -EOPNOSUPP

From: Amir Goldstein <amir73il@gmail.com>
Date: 2025-07-01 14:16:28
Also in: linux-fsdevel, linux-xfs, lkml, selinux

On Tue, Jul 1, 2025 at 2:51 PM Jan Kara [off-list ref] wrote:
On Tue 01-07-25 08:05:45, Amir Goldstein wrote:
quoted
On Mon, Jun 30, 2025 at 6:20 PM Andrey Albershteyn [off-list ref] wrote:
quoted
Future patches will add new syscalls which use these functions. As
this interface won't be used for ioctls only, the EOPNOSUPP is more
appropriate return code.

This patch converts return code from ENOIOCTLCMD to EOPNOSUPP for
vfs_fileattr_get and vfs_fileattr_set. To save old behavior translate
EOPNOSUPP back for current users - overlayfs, encryptfs and fs/ioctl.c.

Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
...
quoted
quoted
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -721,7 +721,7 @@ int ovl_real_fileattr_get(const struct path *realpath, struct fileattr *fa)
                return err;

        err = vfs_fileattr_get(realpath->dentry, fa);
-       if (err == -ENOIOCTLCMD)
+       if (err == -EOPNOTSUPP)
                err = -ENOTTY;
        return err;
 }
That's the wrong way, because it hides the desired -EOPNOTSUPP
return code from ovl_fileattr_get().

The conversion to -ENOTTY was done for
5b0a414d06c3 ("ovl: fix filattr copy-up failure"),
so please do this instead:
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -722,7 +722,7 @@ int ovl_real_fileattr_get(const struct path
*realpath, struct fileattr *fa)

        err = vfs_fileattr_get(realpath->dentry, fa);
        if (err == -ENOIOCTLCMD)
-               err = -ENOTTY;
+               err = -EOPNOTSUPP;
Is this really needed? AFAICS nobody returns ENOIOCTLCMD after this
patch...
you are right it is not needed

Attaching the patch with missing bits of fuse and overlayfs to make this
conversion complete.

Christian, please squash my patch
and afterward make sure there is no conversion remaining in
ovl_real_fileattr_get() as well as in ecryptfs_fileattr_get()
Both those helpers should return the value they
got from vfs_fileattr_get() as is.

Thanks,
Amir.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help