Messages in this thread Patch in this message | | | From | David Howells <> | Subject | [PATCH] Make CacheFS return the right error upon invalid mount | Date | Wed, 08 Sep 2004 11:43:26 +0100 |
| |
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 <dhowells@redhat.com> ---
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); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |