Re: [PATCH] EVMS core 1/4: evms.c

From: Alexander Viro (viro@math.psu.edu)
Date: Fri Oct 04 2002 - 10:11:07 EST


On Fri, 4 Oct 2002, Christoph Hellwig wrote:

> I don't think this is_busy check is a good idea. Anyways
> it should be better something like this (then in block_dev.c):
>
> int bd_busy(struct block_device *bdev)
> {
> int res = 0;
> spin_lock(&bdev_lock);
> if (bdev->bd_holder)
> res = -EBUSY;
> spin_unlock(&bdev_lock);
> return res;
> }

It's completely useless - any code that actually relies on its value is
racy, since there's nothing to prevent bd_claim() from being called
just as we drop bdev_lock.

The same applies to original version - if you want to protect some area,
use bd_claim() and don't release it until you are out of critical area,
damnit.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 07 2002 - 22:00:45 EST