Whamcloud - gitweb
e2fsck: Open the external journal in exclusive mode
authorTheodore Ts'o <tytso@mit.edu>
Sun, 26 Sep 2010 01:14:06 +0000 (21:14 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 30 Apr 2011 16:27:13 +0000 (12:27 -0400)
This prevents accidentally replaying and resetting the journal while
it is mounted, due to an accidental attempt to run e2fsck on an LVM
snapshot of a file system with an external journal.

Addresses-Debian-Bug: #587531

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/journal.c

index 64a0fd6..b741eb9 100644 (file)
@@ -368,7 +368,8 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
 #ifndef USE_INODE_IO
        if (ext_journal)
 #endif
-               retval = io_ptr->open(journal_name, IO_FLAG_RW,
+               retval = io_ptr->open(journal_name,
+                                     IO_FLAG_RW | IO_FLAG_EXCLUSIVE,
                                      &ctx->journal_io);
        if (retval)
                goto errout;