From: David Howells <dhowells@redhat.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Danny ter Haar <dth@ncc1701.cistron.net>,
jamagallon@able.es, linux-kernel@vger.kernel.org
Subject: [PATCH] Make CacheFS return the right error upon invalid mount
Date: Wed, 08 Sep 2004 11:43:26 +0100 [thread overview]
Message-ID: <3954.1094640206@redhat.com> (raw)
In-Reply-To: <20040908013959.3bfe29ea.akpm@osdl.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 <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);
parent reply other threads:[~2004-09-08 10:43 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20040908013959.3bfe29ea.akpm@osdl.org>]
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=3954.1094640206@redhat.com \
--to=dhowells@redhat.com \
--cc=akpm@osdl.org \
--cc=dth@ncc1701.cistron.net \
--cc=jamagallon@able.es \
--cc=linux-kernel@vger.kernel.org \
/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