mirror of
https://github.com/torvalds/linux.git
synced 2025-11-30 23:16:01 +07:00
fs: return EOPNOTSUPP from file_setattr/file_getattr syscalls
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> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
4dd5b5ac08
commit
d90ad28e8a
@@ -416,6 +416,8 @@ SYSCALL_DEFINE5(file_getattr, int, dfd, const char __user *, filename,
|
||||
}
|
||||
|
||||
error = vfs_fileattr_get(filepath.dentry, &fa);
|
||||
if (error == -ENOIOCTLCMD || error == -ENOTTY)
|
||||
error = -EOPNOTSUPP;
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
@@ -483,6 +485,8 @@ SYSCALL_DEFINE5(file_setattr, int, dfd, const char __user *, filename,
|
||||
if (!error) {
|
||||
error = vfs_fileattr_set(mnt_idmap(filepath.mnt),
|
||||
filepath.dentry, &fa);
|
||||
if (error == -ENOIOCTLCMD || error == -ENOTTY)
|
||||
error = -EOPNOTSUPP;
|
||||
mnt_drop_write(filepath.mnt);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user