From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: tytso@mit.edu, darrick.wong@oracle.com
Cc: linux-ext4@vger.kernel.org, TR Reardon <thomas_reardon@hotmail.com>
Subject: [PATCH 07/25] tune2fs: explicitly disallow tuning of journal devices
Date: Mon, 08 Sep 2014 16:12:21 -0700 [thread overview]
Message-ID: <20140908231221.25904.95895.stgit@birch.djwong.org> (raw)
In-Reply-To: <20140908231135.25904.66591.stgit@birch.djwong.org>
Spit out a more specific error if someone tries to modify an
external journal device.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reported-by: TR Reardon <thomas_reardon@hotmail.com>
---
misc/tune2fs.c | 8 +++++++-
tests/t_ext_jnl_fail/expect | 6 ++++++
tests/t_ext_jnl_fail/name | 1 +
tests/t_ext_jnl_fail/script | 30 ++++++++++++++++++++++++++++++
4 files changed, 44 insertions(+), 1 deletion(-)
create mode 100644 tests/t_ext_jnl_fail/expect
create mode 100644 tests/t_ext_jnl_fail/name
create mode 100644 tests/t_ext_jnl_fail/script
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index ee47c04..c22c8fd 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -2539,7 +2539,7 @@ retry_open:
if ((open_flag & EXT2_FLAG_RW) == 0 || f_flag)
open_flag |= EXT2_FLAG_SKIP_MMP;
- open_flag |= EXT2_FLAG_64BITS;
+ open_flag |= EXT2_FLAG_64BITS | EXT2_FLAG_JOURNAL_DEV_OK;
/* keep the filesystem struct around to dump MMP data */
open_flag |= EXT2_FLAG_NOFREE_ON_ERROR;
@@ -2569,6 +2569,12 @@ retry_open:
ext2fs_free(fs);
exit(1);
}
+ if (EXT2_HAS_INCOMPAT_FEATURE(fs->super,
+ EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) {
+ fprintf(stderr, "%s", _("Cannot modify a journal device.\n"));
+ ext2fs_free(fs);
+ exit(1);
+ }
fs->default_bitmap_type = EXT2FS_BMAP64_RBTREE;
if (I_flag && !io_ptr_orig) {
diff --git a/tests/t_ext_jnl_fail/expect b/tests/t_ext_jnl_fail/expect
new file mode 100644
index 0000000..db0aecb
--- /dev/null
+++ b/tests/t_ext_jnl_fail/expect
@@ -0,0 +1,6 @@
+Creating filesystem with 4096 1k blocks and 0 inodes
+Superblock backups stored on blocks:
+
+Zeroing journal device: \b\b\b\b\b\b\b\b\b
+tune2fs external journal
+Cannot modify a journal device.
diff --git a/tests/t_ext_jnl_fail/name b/tests/t_ext_jnl_fail/name
new file mode 100644
index 0000000..2fe7d04
--- /dev/null
+++ b/tests/t_ext_jnl_fail/name
@@ -0,0 +1 @@
+tune2fs fail external journal
diff --git a/tests/t_ext_jnl_fail/script b/tests/t_ext_jnl_fail/script
new file mode 100644
index 0000000..bb31cc7
--- /dev/null
+++ b/tests/t_ext_jnl_fail/script
@@ -0,0 +1,30 @@
+FSCK_OPT=-fy
+OUT=$test_name.log
+if [ -f $test_dir/expect.gz ]; then
+ EXP=$test_name.tmp
+ gunzip < $test_dir/expect.gz > $EXP1
+else
+ EXP=$test_dir/expect
+fi
+
+cp /dev/null $OUT
+
+$MKE2FS -F -o Linux -b 1024 -O journal_dev,metadata_csum -T ext4 $TMPFILE 4096 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
+echo "tune2fs external journal" >> $OUT
+$TUNE2FS -i 0 $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
+
+rm -f $TMPFILE
+
+cmp -s $OUT $EXP
+status=$?
+
+if [ "$status" = 0 ] ; then
+ echo "$test_name: $test_description: ok"
+ touch $test_name.ok
+else
+ echo "$test_name: $test_description: failed"
+ diff $DIFF_OPTS $EXP $OUT > $test_name.failed
+ rm -f $test_name.tmp
+fi
+
+unset IMAGE FSCK_OPT OUT EXP
next prev parent reply other threads:[~2014-09-08 23:12 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-08 23:11 [PATCH 00/25] e2fsprogs Summer 2014 patchbomb, part 5.2 Darrick J. Wong
2014-09-08 23:11 ` [PATCH 01/25] e2fsck/debugfs: fix descriptor block size handling errors with journal_csum Darrick J. Wong
2014-09-11 16:43 ` Theodore Ts'o
2014-09-08 23:11 ` [PATCH 02/25] libext2fs: report bad magic over bad sb checksum Darrick J. Wong
2014-09-11 16:43 ` Theodore Ts'o
2014-09-08 23:11 ` [PATCH 03/25] misc: don't return ENOMEM if we run out of disk space Darrick J. Wong
2014-09-11 16:43 ` Theodore Ts'o
2014-09-08 23:12 ` [PATCH 04/25] libext2fs: write_journal_inode should check iterate return value Darrick J. Wong
2014-09-11 16:43 ` Theodore Ts'o
2014-09-08 23:12 ` [PATCH 05/25] mke2fs: allow creation of journal device with superblock checksum Darrick J. Wong
2014-09-11 16:43 ` Theodore Ts'o
2014-09-08 23:12 ` [PATCH 06/25] e2fsck: detect and repair external journal superblock checksum errors Darrick J. Wong
2014-09-11 16:43 ` Theodore Ts'o
2014-09-08 23:12 ` Darrick J. Wong [this message]
2014-09-11 16:44 ` [PATCH 07/25] tune2fs: explicitly disallow tuning of journal devices Theodore Ts'o
2014-09-08 23:12 ` [PATCH 08/25] dumpe2fs: display external journal feature flags Darrick J. Wong
2014-09-11 16:44 ` Theodore Ts'o
2014-09-08 23:12 ` [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal Darrick J. Wong
2014-09-11 16:44 ` Theodore Ts'o
2014-09-08 23:12 ` [PATCH 10/25] debugfs: create journal handling routines Darrick J. Wong
2014-09-11 18:53 ` Theodore Ts'o
2014-09-11 19:03 ` Darrick J. Wong
2014-09-11 20:14 ` Theodore Ts'o
2014-09-11 20:25 ` Darrick J. Wong
2014-09-08 23:12 ` [PATCH 11/25] e2fsck: fix minor errors in journal handling Darrick J. Wong
2014-09-11 20:58 ` Theodore Ts'o
2014-09-08 23:12 ` [PATCH 12/25] debugfs: add the ability to write transactions to the journal Darrick J. Wong
2014-09-11 20:58 ` Theodore Ts'o
2014-09-08 23:13 ` [PATCH 13/25] tests: test writing and recovering checksum-free 32/64bit journals Darrick J. Wong
2014-09-11 20:59 ` Theodore Ts'o
2014-09-08 23:13 ` [PATCH 14/25] tests: test writing and recovering 64bit csum_v3 journals Darrick J. Wong
2014-09-11 20:59 ` Theodore Ts'o
2014-09-08 23:13 ` [PATCH 15/25] tests: test writing and recovering 32bit " Darrick J. Wong
2014-09-11 20:59 ` Theodore Ts'o
2014-09-08 23:13 ` [PATCH 16/25] tests: write and replay blocks with the old journal checksum Darrick J. Wong
2014-09-11 20:59 ` Theodore Ts'o
2014-09-08 23:13 ` [PATCH 17/25] tests: test recovery of 32 and 64-bit journals with checksum v2 Darrick J. Wong
2014-09-11 20:59 ` Theodore Ts'o
2014-09-08 23:13 ` [PATCH 18/25] tests: test how e2fsck recovers from corrupt journal superblocks Darrick J. Wong
2014-09-11 21:04 ` Theodore Ts'o
2014-09-08 23:13 ` [PATCH 19/25] tests: test e2fsck recovery of corrupt revoke blocks Darrick J. Wong
2014-09-11 21:04 ` Theodore Ts'o
2014-09-08 23:13 ` [PATCH 20/25] tests: test e2fsck recovery with broken commit blocks Darrick J. Wong
2014-09-11 21:04 ` Theodore Ts'o
2014-09-08 23:13 ` [PATCH 21/25] tests: test e2fsck recovery of corrupt descriptor blocks Darrick J. Wong
2014-09-10 1:15 ` Darrick J. Wong
2014-09-11 17:33 ` Darrick J. Wong
2014-09-11 18:18 ` Theodore Ts'o
2014-09-11 18:40 ` Darrick J. Wong
2014-09-11 19:31 ` [PATCH 21/25 v2] " Darrick J. Wong
2014-09-11 22:34 ` Theodore Ts'o
2014-09-08 23:14 ` [PATCH 22/25] tests: test recovery from an external journal Darrick J. Wong
2014-09-11 21:04 ` Theodore Ts'o
2014-09-08 23:14 ` [PATCH 23/25] ext2fs: add readahead method to improve scanning Darrick J. Wong
2014-09-11 21:10 ` Theodore Ts'o
2014-09-11 21:29 ` [PATCH 23/25 v2] " Darrick J. Wong
2014-09-08 23:14 ` [PATCH 24/25] libext2fs/e2fsck: provide routines to read-ahead metadata Darrick J. Wong
2014-09-08 23:14 ` [PATCH 25/25] e2fsck: read-ahead metadata during passes 1, 2, and 4 Darrick J. Wong
2014-09-09 22:53 ` [PATCH 00/25] e2fsprogs Summer 2014 patchbomb, part 5.2 Andreas Dilger
2014-09-10 1:13 ` Darrick J. Wong
2014-09-11 19:41 ` [PATCH 26/25] libext2fs: call get_alloc_block hook when allocating blocks Darrick J. Wong
2014-09-11 22:05 ` Theodore Ts'o
2014-09-11 22:34 ` Darrick J. Wong
2014-09-12 17:35 ` Theodore Ts'o
2014-09-12 17:57 ` Darrick J. Wong
2014-09-12 22:17 ` Theodore Ts'o
2014-09-13 0:13 ` Darrick J. Wong
2014-09-11 19:43 ` [PATCH 27/25] tune2fs: always check disable_uninit_bg() return code Darrick J. Wong
2014-09-11 22:07 ` Theodore Ts'o
2014-09-11 19:44 ` [PATCH 28/25] e2fsck: ignore badblocks if it says badblocks inode is bad Darrick J. Wong
2014-09-11 22:09 ` Theodore Ts'o
2014-09-11 19:48 ` [PATCH 29/25] e2fsck: expand root dir if linking l+f fails Darrick J. Wong
2014-09-11 22:10 ` Theodore Ts'o
2014-09-11 20:17 ` [PATCH 30/25] libext2fs: check ea value offset when loading Darrick J. Wong
2014-09-11 22:11 ` Theodore Ts'o
2014-09-11 22:33 ` [PATCH 00/25] e2fsprogs Summer 2014 patchbomb, part 5.2 Theodore Ts'o
2014-09-11 22:50 ` Darrick J. Wong
2014-09-11 22:52 ` Theodore Ts'o
2014-09-11 23:07 ` Darrick J. Wong
2014-09-11 23:14 ` Theodore Ts'o
2014-09-11 23:30 ` Darrick J. Wong
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=20140908231221.25904.95895.stgit@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=linux-ext4@vger.kernel.org \
--cc=thomas_reardon@hotmail.com \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).