linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: HIBINO Kei <ex8k-hbn@asahi-net.or.jp>
To: linux-kernel@vger.kernel.org, alan@lxorguk.ukuu.org.uk
Subject: [PATCH] Atomic lock
Date: Mon, 08 Jan 2001 02:46:51 +0900	[thread overview]
Message-ID: <87ae93l0fo.wl@strawberry.hibi-local.net> (raw)


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/

                 reply	other threads:[~2001-01-07 17:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ae93l0fo.wl@strawberry.hibi-local.net \
    --to=ex8k-hbn@asahi-net.or.jp \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).