Skip to contentSkip to conversation

fs: inode: return proper errno on bmap()

PATCH In review Leesoo Ahn 2 participants 2 messages Jul 15, 2023 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Leesoo Ahn

author
#0 lore raw

PATCH 1/1 fs: inode: return proper errno on bmap()

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.

---
 fs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/inode.c +1 -1
index 8fefb69e1f84..c13cac26f08d 100644
@@ -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;
Signature · 1 line
2.34.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

2023-07-15 오후 3:39에 Markus Elfring 이(가) 쓴 글:

Quoted 16 lines
Quoted 5 lines

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.

Are imperative change descriptions still preferred?

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.5-rc1#n94

How do you think about to use a subject like “[PATCH v2] fs: inode:
Return proper error code in bmap()”?

Quoted 5 lines

Please reconsider also the distribution of addresses in recipient lists.
https://lore.kernel.org/lkml/[email protected]/

Regards,
Markus

Thank you for the feedback.
I will post v2 patch soon

best regards,
Leesoo