aboutsummaryrefslogtreecommitdiffstats
path: root/e2fsck/journal.c
diff options
context:
space:
mode:
Diffstat (limited to 'e2fsck/journal.c')
-rw-r--r--e2fsck/journal.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 59ccc0e6..fd6d6caa 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -419,9 +419,19 @@ 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 | IO_FLAG_EXCLUSIVE,
+ {
+ int flags = IO_FLAG_RW;
+ if (!(ctx->mount_flags & EXT2_MF_ISROOT &&
+ ctx->mount_flags & EXT2_MF_READONLY))
+ flags |= IO_FLAG_EXCLUSIVE;
+ if ((ctx->mount_flags & EXT2_MF_READONLY) &&
+ (ctx->options & E2F_OPT_FORCE))
+ flags &= ~IO_FLAG_EXCLUSIVE;
+
+
+ retval = io_ptr->open(journal_name, flags,
&ctx->journal_io);
+ }
if (retval)
goto errout;