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 [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to