Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1631193 > unrolled thread

[PATCH] fs:affs:fix sb_bread() return value

Started byHeloise <os@iscas.ac.cn>
First post2017-04-26 09:10 +0200
Last post2017-04-26 09:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] fs:affs:fix sb_bread() return value Heloise <os@iscas.ac.cn> - 2017-04-26 09:10 +0200
    Re: [PATCH] fs:affs:fix sb_bread() return value Jan Kara <jack@suse.cz> - 2017-04-26 09:50 +0200

#1631193 — [PATCH] fs:affs:fix sb_bread() return value

FromHeloise <os@iscas.ac.cn>
Date2017-04-26 09:10 +0200
Subject[PATCH] fs:affs:fix sb_bread() return value
Message-ID<tApfj-7oc-3@gated-at.bofh.it>
When the function sb_bread() fails, the return value should
be -EIO, fix it.

Signed-off-by: Heloise <os@iscas.ac.cn>
---
 fs/affs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/affs/super.c b/fs/affs/super.c
index c2c27a8..df1f4fe 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -419,7 +419,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
 	boot_bh = sb_bread(sb, 0);
 	if (!boot_bh) {
 		pr_err("Cannot read boot block\n");
-		return -EINVAL;
+		return -EIO;
 	}
 	memcpy(sig, boot_bh->b_data, 4);
 	brelse(boot_bh);
-- 
2.1.0

[toc] | [next] | [standalone]


#1631212

FromJan Kara <jack@suse.cz>
Date2017-04-26 09:50 +0200
Message-ID<tApS1-7Eb-7@gated-at.bofh.it>
In reply to#1631193
On Tue 25-04-17 23:59:14, Heloise wrote:
> When the function sb_bread() fails, the return value should
> be -EIO, fix it.
> 
> Signed-off-by: Heloise <os@iscas.ac.cn>

Well, in the mount(2) manpage we have:

EINVAL source had an invalid superblock. Or, a remount (MS_REMOUNT) was
attempted, but source was not already mounted on target. Or, a move
(MS_MOVE) was attempted, but source was not a mount point, or was '/'.

And EIO is not documented as possible error for mount(2). Looking at e.g.
ext4 it also returns EINVAL when superblock cannot be read so I guess it is
an expected return value in this case.

								Honza

> ---
>  fs/affs/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/affs/super.c b/fs/affs/super.c
> index c2c27a8..df1f4fe 100644
> --- a/fs/affs/super.c
> +++ b/fs/affs/super.c
> @@ -419,7 +419,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
>  	boot_bh = sb_bread(sb, 0);
>  	if (!boot_bh) {
>  		pr_err("Cannot read boot block\n");
> -		return -EINVAL;
> +		return -EIO;
>  	}
>  	memcpy(sig, boot_bh->b_data, 4);
>  	brelse(boot_bh);
> -- 
> 2.1.0
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web