]> bbs.cooldavid.org Git - net-next-2.6.git/commit
reiserfs: properly honor read-only devices
authorJeff Mahoney <jeffm@suse.com>
Tue, 23 Mar 2010 20:35:39 +0000 (13:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 24 Mar 2010 23:31:21 +0000 (16:31 -0700)
commit3f8b5ee33293d43ca360771b535dfae8c57259dc
treef533b80b6ad553882e81799b17e0cf94e41bf70e
parent6cb4aff0a77cc0e6bae9475d62205319e3ebbf3f
reiserfs: properly honor read-only devices

The reiserfs journal behaves inconsistently when determining whether to
allow a mount of a read-only device.

This is due to the use of the continue_replay variable to short circuit
the journal scanning.  If it's set, it's assumed that there are
transactions to replay, but there may not be.  If it's unset, it's assumed
that there aren't any, and that may not be the case either.

I've observed two failure cases:
1) Where a clean file system on a read-only device refuses to mount
2) Where a clean file system on a read-only device passes the
   optimization and then tries writing the journal header to update
   the latest mount id.

The former is easily observable by using a freshly created file system on
a read-only loopback device.

This patch moves the check into journal_read_transaction, where it can
bail out before it's about to replay a transaction.  That way it can go
through and skip transactions where appropriate, yet still refuse to mount
a file system with outstanding transactions.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/reiserfs/journal.c