* [PATCH] Atomic lock
@ 2001-01-07 17:46 HIBINO Kei
0 siblings, 0 replies; only message in thread
From: HIBINO Kei @ 2001-01-07 17:46 UTC (permalink / raw)
To: linux-kernel, alan
I think atomic lock is needed for SMP code.
diff -ur linux-2.2.19pre6/drivers/block/ll_rw_blk.c linux-2.2.19pre6+lockfix/drivers/block/ll_rw_blk.c
--- linux-2.2.19pre6/drivers/block/ll_rw_blk.c Mon Dec 11 09:49:41 2000
+++ linux-2.2.19pre6+lockfix/drivers/block/ll_rw_blk.c Mon Jan 8 02:40:37 2001
@@ -578,11 +578,9 @@
count = bh->b_size >> 9;
sector = bh->b_rsector;
- /* Uhhuh.. Nasty dead-lock possible here.. */
- if (buffer_locked(bh))
+ if(test_and_set_bit(BH_Lock, &bh->b_state)) { /* Does atomic lock resolv problems? */
return;
- /* Maybe the above fixes it, and maybe it doesn't boot. Life is interesting */
- lock_buffer(bh);
+ }
if (blk_size[major]) {
unsigned long maxsector = (blk_size[major][MINOR(bh->b_rdev)] << 1) + 1;
diff -ur linux-2.2.19pre6/drivers/block/md.c linux-2.2.19pre6+lockfix/drivers/block/md.c
--- linux-2.2.19pre6/drivers/block/md.c Tue Sep 5 02:39:16 2000
+++ linux-2.2.19pre6+lockfix/drivers/block/md.c Mon Jan 8 02:41:19 2001
@@ -778,9 +778,9 @@
int md_make_request (int minor, int rw, struct buffer_head * bh)
{
if (md_dev [minor].pers->make_request) {
- if (buffer_locked(bh))
+ if(test_and_set_bit(BH_Lock, &bh->b_state)) { /* atomic lock */
return 0;
- set_bit(BH_Lock, &bh->b_state);
+ }
if (rw == WRITE || rw == WRITEA) {
if (!buffer_dirty(bh)) {
bh->b_end_io(bh, test_bit(BH_Uptodate, &bh->b_state));
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-01-07 17:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-07 17:46 [PATCH] Atomic lock HIBINO Kei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®