diff options
author | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2007-04-03 15:29:16 +0000 |
---|---|---|
committer | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2007-04-03 15:29:16 +0000 |
commit | 89f75c2a047da4c718244c9922ba2b5a6eecaaf6 (patch) | |
tree | d45dc0ef6dfc75248745ba5cc8bdc1f51e3921c9 | |
parent | e64bec2cfb054c7dedc125d456d6d521b1743726 (diff) | |
download | src-89f75c2a047da4c718244c9922ba2b5a6eecaaf6.tar.gz src-89f75c2a047da4c718244c9922ba2b5a6eecaaf6.zip |
- 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.
Notes
Notes:
svn path=/head/; revision=168304
-rw-r--r-- | sbin/geom/class/journal/geom_journal.c | 15 |
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 5cd7b4caa2f8..ea620b2e28ed 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).", |