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

From: Jiri Slaby

Date: Mon Oct 06 2025 - 07:09:11 EST


On 30. 06. 25, 18:20, Andrey Albershteyn wrote:
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@xxxxxxxxxx>
...
@@ -292,6 +294,8 @@ int ioctl_setflags(struct file *file, unsigned int __user *argp)
fileattr_fill_flags(&fa, flags);
err = vfs_fileattr_set(idmap, dentry, &fa);
mnt_drop_write_file(file);
+ if (err == -EOPNOTSUPP)
+ err = -ENOIOCTLCMD;

This breaks borg code (unit tests already) as it expects EOPNOTSUPP, not ENOIOCTLCMD/ENOTTY:
https://github.com/borgbackup/borg/blob/1c6ef7a200c7f72f8d1204d727fea32168616ceb/src/borg/platform/linux.pyx#L147

I.e. setflags now returns ENOIOCTLCMD/ENOTTY for cases where 6.16 used to return EOPNOTSUPP.

This minimal testcase program doing ioctl(fd2, FS_IOC_SETFLAGS, &FS_NODUMP_FL):
https://github.com/jirislaby/collected_sources/tree/master/ioctl_setflags

dumps in 6.16:
sf: ioctl: Operation not supported

with the above patch:
sf: ioctl: Inappropriate ioctl for device


Is this expected?

thanks,
--
js
suse labs