linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Albershteyn <aalbersh@redhat.com>
To: linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	 linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org
Cc: Jan Kara <jack@suse.cz>, Jiri Slaby <jirislaby@kernel.org>,
	 Christian Brauner <brauner@kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	 Andrey Albershteyn <aalbersh@kernel.org>
Subject: [PATCH 2/2] fs: return EOPNOTSUPP from file_setattr/file_getattr syscalls
Date: Wed, 08 Oct 2025 14:44:18 +0200	[thread overview]
Message-ID: <20251008-eopnosupp-fix-v1-2-5990de009c9f@kernel.org> (raw)
In-Reply-To: <20251008-eopnosupp-fix-v1-0-5990de009c9f@kernel.org>

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)
+		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 = -EOPNOTSUPP;
 		mnt_drop_write(filepath.mnt);
 	}
 

-- 
2.51.0


  parent reply	other threads:[~2025-10-08 12:44 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 ` Andrey Albershteyn [this message]
2025-10-08 13:23   ` [PATCH 2/2] fs: return EOPNOTSUPP from file_setattr/file_getattr syscalls 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
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=20251008-eopnosupp-fix-v1-2-5990de009c9f@kernel.org \
    --to=aalbersh@redhat.com \
    --cc=aalbersh@kernel.org \
    --cc=arnd@arndb.de \
    --cc=brauner@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;
as well as URLs for NNTP newsgroup(s).