From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S269094AbUIHKnm (ORCPT ); Wed, 8 Sep 2004 06:43:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S269097AbUIHKnm (ORCPT ); Wed, 8 Sep 2004 06:43:42 -0400 Received: from mx1.redhat.com ([66.187.233.31]:35757 "EHLO mx1.redhat.com") by vger.kernel.org with ESMTP id S269094AbUIHKnj (ORCPT ); Wed, 8 Sep 2004 06:43:39 -0400 From: David Howells In-Reply-To: <20040908013959.3bfe29ea.akpm@osdl.org> To: Andrew Morton Cc: Danny ter Haar , jamagallon@able.es, linux-kernel@vger.kernel.org Subject: [PATCH] Make CacheFS return the right error upon invalid mount User-Agent: EMH/1.14.1 SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 Emacs/21.3 (i386-redhat-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII Date: Wed, 08 Sep 2004 11:43:26 +0100 Message-ID: <3954.1094640206@redhat.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org The attached patch makes CacheFS return -EINVAL if the magic number on disc doesn't match what it's expecting (rather than -EIO). Also it moves the check that the partition is not read-only further down to avoid a return of -EROFS instead or -EINVAL. Signed-Off-By: David Howells --- super.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff -u linux-2.6.9-rc1-mm4/fs/cachefs/super.c linux-2.6.9-rc1-mm4-afs/fs/cachefs/super.c --- linux-2.6.9-rc1-mm4/fs/cachefs/super.c 2004-09-07 10:51:28.000000000 +0100 +++ linux-2.6.9-rc1-mm4-afs/fs/cachefs/super.c 2004-09-08 11:35:31.556761460 +0100 @@ -232,16 +232,6 @@ _enter(""); - if (bdev_read_only(sb->s_bdev)) { - printk("CacheFS: blockdev read-only\n"); - return -EROFS; - } - - if (sb->s_flags & MS_RDONLY) { - printk("CacheFS: filesystem mounted read-only\n"); - return -EROFS; - } - /* we want the block size to be at least as big as the size of a * journal entry */ if (!sb_min_blocksize(sb, @@ -398,10 +388,20 @@ } else { printk("CacheFS: Wrong magic number on cache\n"); - ret = -EIO; + ret = -EINVAL; goto error; } + /* a read-only cache isn't a lot of use */ + ret = -EROFS; + if (bdev_read_only(sb->s_bdev)) { + printk("CacheFS: blockdev read-only\n"); + } + + if (sb->s_flags & MS_RDONLY) { + printk("CacheFS: filesystem mounted read-only\n"); + } + /* replay the journal if the cache was initialised */ super->ujnl_jsof = super->layout->bix_ujournal; super->ujnl_jsof <<= (PAGE_SHIFT - super->sb->s_blocksize_bits);