* [PATCH] Make CacheFS return the right error upon invalid mount
[not found] <20040908013959.3bfe29ea.akpm@osdl.org>
@ 2004-09-08 10:43 ` David Howells
0 siblings, 0 replies; only message in thread
From: David Howells @ 2004-09-08 10:43 UTC (permalink / raw)
To: Andrew Morton; +Cc: Danny ter Haar, jamagallon, linux-kernel
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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-09-08 10:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20040908013959.3bfe29ea.akpm@osdl.org>
2004-09-08 10:43 ` [PATCH] Make CacheFS return the right error upon invalid mount David Howells
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.