Message ID | 4C598E6B.7050405@gmail.com |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
On 2010-08-04 17:59, Tejun Heo wrote: > 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 Thanks Tejun, applied.
On Thu, Aug 05, 2010 at 11:02:43AM +0200, Jens Axboe wrote: > On 2010-08-04 17:59, Tejun Heo wrote: > > 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 > > Thanks Tejun, applied. It's already in mainline: e75aa85892b2ee78c79edac720868cbef16e62eb
On 2010-08-05 11:17, Markus Trippelsdorf wrote: > On Thu, Aug 05, 2010 at 11:02:43AM +0200, Jens Axboe wrote: >> On 2010-08-04 17:59, Tejun Heo wrote: >>> 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 >> >> Thanks Tejun, applied. > > It's already in mainline: > e75aa85892b2ee78c79edac720868cbef16e62eb Irk, had not noticed yet, my for-2.6.36 branch isn't fully merged up yet. Thanks for the heads-up.
diff --git a/fs/block_dev.c b/fs/block_dev.c index 99d6af8..b3171fb 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -681,8 +681,8 @@ retry: if (!bd_may_claim(bdev, whole, holder)) return -EBUSY; - /* if someone else is claiming, wait for it to finish */ - if (whole->bd_claiming && whole->bd_claiming != holder) { + /* if claiming is already in progress, wait for it to finish */ + if (whole->bd_claiming) { wait_queue_head_t *wq = bit_waitqueue(&whole->bd_claiming, 0); DEFINE_WAIT(wait);
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 --- Oops, had the wrong reported-by credit. Updated. Thanks. fs/block_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html