]> git.baikalelectronics.ru Git - kernel.git/commit
block_dev: always serialize exclusive open attempts
authorTejun Heo <htejun@gmail.com>
Wed, 4 Aug 2010 15:59:39 +0000 (17:59 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 4 Aug 2010 18:17:10 +0000 (11:17 -0700)
commitacd575ab46593afc46403d032a5700595ece8204
tree80b9ce187b207a1a817b9b4b172f86fa71d75212
parent1d80c5ff66001e5d24310f0f53ba0ae61480a90d
block_dev: always serialize exclusive open attempts

bd_prepare_to_claim() incorrectly allowed multiple attempts for
exclusive open to progress in parallel if the attempting holders are
identical.  This triggered BUG_ON() as reported in the following bug.

  https://bugzilla.kernel.org/show_bug.cgi?id=16393

__bd_abort_claiming() is used to finish claiming blocks and doesn't
work if multiple openers are inside a claiming block.  Allowing
multiple parallel open attempts to continue doesn't gain anything as
those are serialized down in the call chain anyway.  Fix it by always
allowing only single open attempt in a claiming block.

This problem can easily be reproduced by adding a delay after
bd_prepare_to_claim() and attempting to mount two partitions of a
disk.

stable: only applicable to v2.6.35

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/block_dev.c