linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leesoo Ahn <lsahn@ooseel.net>
To: lsahn@wewakecorp.com
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] fs: inode: return proper errno on bmap()
Date: Sat, 15 Jul 2023 15:02:17 +0900	[thread overview]
Message-ID: <20230715060217.1469690-1-lsahn@wewakecorp.com> (raw)

It better returns -EOPNOTSUPP instead of -EINVAL which has meaning of
the argument is an inappropriate value. It doesn't make sense in the
case of that a file system doesn't support bmap operation.

-EINVAL could make confusion in the userspace perspective.

Signed-off-by: Leesoo Ahn <lsahn@wewakecorp.com>
---
 fs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/inode.c b/fs/inode.c
index 8fefb69e1f84..c13cac26f08d 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1837,7 +1837,7 @@ EXPORT_SYMBOL(iput);
 int bmap(struct inode *inode, sector_t *block)
 {
 	if (!inode->i_mapping->a_ops->bmap)
-		return -EINVAL;
+		return -EOPNOTSUPP;
 
 	*block = inode->i_mapping->a_ops->bmap(inode->i_mapping, *block);
 	return 0;
-- 
2.34.1


             reply	other threads:[~2023-07-15  6:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-15  6:02 Leesoo Ahn [this message]
     [not found] ` <fa1386fb-04af-8037-2591-781f8723d564@web.de>
2023-07-15  6:49   ` [PATCH] fs: inode: return proper errno on bmap() Leesoo Ahn

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=20230715060217.1469690-1-lsahn@wewakecorp.com \
    --to=lsahn@ooseel.net \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lsahn@wewakecorp.com \
    --cc=viro@zeniv.linux.org.uk \
    /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).