Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1953738AbdDZHqg (ORCPT ); Wed, 26 Apr 2017 03:46:36 -0400 Received: from mx2.suse.de ([195.135.220.15]:46918 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1952030AbdDZHq2 (ORCPT ); Wed, 26 Apr 2017 03:46:28 -0400 Date: Wed, 26 Apr 2017 09:46:20 +0200 From: Jan Kara To: Heloise 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 Message-ID: <20170426074620.GC21218@quack2.suse.cz> References: <1493189954-10049-1-git-send-email-os@iscas.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1493189954-10049-1-git-send-email-os@iscas.ac.cn> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1193 Lines: 42 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 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 SUSE Labs, CR