mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Heloise <os@iscas.ac.cn>
Cc: akpm@linux-foundation.org, fabf@skynet.be,
	viro@zeniv.linux.org.uk, jack@suse.cz, mszeredi@redhat.com,
	mikulas@twibright.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs:affs:fix sb_bread() return value
Date: Wed, 26 Apr 2017 09:46:20 +0200	[thread overview]
Message-ID: <20170426074620.GC21218@quack2.suse.cz> (raw)
In-Reply-To: <1493189954-10049-1-git-send-email-os@iscas.ac.cn>

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

      reply	other threads:[~2017-04-26  7:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26  6:59 Heloise
2017-04-26  7:46 ` Jan Kara [this message]

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=20170426074620.GC21218@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=fabf@skynet.be \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikulas@twibright.com \
    --cc=mszeredi@redhat.com \
    --cc=os@iscas.ac.cn \
    --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

all inboxes | Powered by JetHome®