freeze_bdev: don't deactivate successfully frozen MS_RDONLY sb
authorJun'ichi Nomura <j-nomura@ce.jp.nec.com>
Fri, 29 Jan 2010 00:56:22 +0000 (09:56 +0900)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 7 Feb 2010 08:06:21 +0000 (03:06 -0500)
commit4b06e5b9ad8abb20105b2b25e42c509ebe9b2d76
treea151e21fef671e9d046a6c456d2f048eea56fb99
parent8dd5ca532c2d2c2b85f16bc038ebfff05b8853e1
freeze_bdev: don't deactivate successfully frozen MS_RDONLY sb

Thanks Thomas and Christoph for testing and review.
I removed 'smp_wmb()' before up_write from the previous patch,
since up_write() should have necessary ordering constraints.
(I.e. the change of s_frozen is visible to others after up_write)
I'm quite sure the change is harmless but if you are uncomfortable
with Tested-by/Reviewed-by on the modified patch, please remove them.

If MS_RDONLY, freeze_bdev should just up_write(s_umount) instead of
deactivate_locked_super().
Also, keep sb->s_frozen consistent so that remount can check the frozen state.

Otherwise a crash reported here can happen:
http://lkml.org/lkml/2010/1/16/37
http://lkml.org/lkml/2010/1/28/53

This patch should be applied for 2.6.32 stable series, too.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Thomas Backlund <tmb@mandriva.org>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Cc: stable@kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/block_dev.c