summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2007-04-03 15:29:16 +0000
committerpjd <pjd@FreeBSD.org>2007-04-03 15:29:16 +0000
commit5ef608fbbe311c6a0ec7a98e18292f12af4d3fea (patch)
treed45dc0ef6dfc75248745ba5cc8bdc1f51e3921c9 /sbin
parenta65de131f1965056554b1c47569f7684ceeedea9 (diff)
downloadFreeBSD-src-5ef608fbbe311c6a0ec7a98e18292f12af4d3fea.zip
FreeBSD-src-5ef608fbbe311c6a0ec7a98e18292f12af4d3fea.tar.gz
- Protect against specifing journal less than 100MB and against journal
which size is not multiple of sector size. Reported by: Eric Anderson <anderson@centtech.com> - Improve wording in error message. I'm sorry, I don't remember who submitted this one.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/geom/class/journal/geom_journal.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sbin/geom/class/journal/geom_journal.c b/sbin/geom/class/journal/geom_journal.c
index 5cd7b4c..ea620b2 100644
--- a/sbin/geom/class/journal/geom_journal.c
+++ b/sbin/geom/class/journal/geom_journal.c
@@ -180,20 +180,29 @@ journal_label(struct gctl_req *req)
case 1:
if (!force && g_journal_fs_exists(data)) {
gctl_error(req, "File system exists on %s and this "
- "operation is going to destroy it. Use -f if you "
+ "operation would destroy it.\nUse -f if you "
"really want to do it.", data);
return;
}
journal = data;
+ msize = g_get_mediasize(data);
+ ssize = g_get_sectorsize(data);
if (jsize == -1) {
/*
* No journal size specified. 1GB should be safe
* default.
*/
jsize = 1073741824ULL;
+ } else {
+ if (jsize < 104857600) {
+ gctl_error(req, "Journal too small.");
+ return;
+ }
+ if ((jsize % ssize) != 0) {
+ gctl_error(req, "Invalid journal size.");
+ return;
+ }
}
- msize = g_get_mediasize(data);
- ssize = g_get_sectorsize(data);
if (jsize + ssize >= msize) {
gctl_error(req, "Provider too small for journalling. "
"You can try smaller jsize (default is %jd).",
OpenPOWER on IntegriCloud