[PATCH] minix: return -EIO when superblock read fails

Vivek BalachandharTN posted 1 patch 2 weeks, 1 day ago
fs/minix/inode.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] minix: return -EIO when superblock read fails
Posted by Vivek BalachandharTN 2 weeks, 1 day ago
When minix_fill_super() fails to read the on-disk superblock, it prints
"MINIX-fs: unable to read superblock" but still returns -EINVAL. This
is misleading for callers, since the failure is due to an I/O error
rather than an invalid superblock format or mount option.

Return -EIO in this case so that the errno better reflects the actual
error condition and allows userspace to distinguish I/O failures from
format or parameter errors.

Signed-off-by: Vivek BalachandharTN <vivek.balachandhar@gmail.com>
---
 fs/minix/inode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 32db676127a9..2b2b64a31724 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -365,6 +365,7 @@ static int minix_fill_super(struct super_block *s, struct fs_context *fc)
 	goto out;
 
 out_bad_sb:
+	ret = -EIO;
 	printk("MINIX-fs: unable to read superblock\n");
 out:
 	s->s_fs_info = NULL;
-- 
2.34.1