mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Philip R. Auld" <pauld@egenera.com>
To: linux-kernel@vger.kernel.org
Subject: Deadlock in sd_open/revalidate [lk <= 2.4]
Date: Mon, 7 Apr 2003 09:20:12 -0400	[thread overview]
Message-ID: <20030407092012.C13667@vienna.EGENERA.COM> (raw)

Hi folks,
	There seems to be a potential deadlock in the sd_open path. The problem
is this while loop:

	...
	while (rscsi_disks[target].device->busy) {
                barrier();
                cpu_relax();
        }
	...

In revalidate_scsidisk we do this:
	
	...
	device->busy = 1;
	...
	almost certain schedule();
	...
	device-busy = 0;

Both paths hold the kernel lock so if sd_open gets into the while loop when 
the revalidate is sleeping it's all over.

As a simple preventative fix I'd say put a schedule in the while loop. It's
a little ugly, but less intrusive that adding a wait queue to the device.

Anoyone see anything wrong with doing that? Other solutions?

This seems to be present in 2.0, 2.2. and 2.4 (where we hit it).
The while-forever-loop-with -kernel-lock seems to be gone in 2.5.


Cheers,

Phil

-- 
Philip R. Auld, Ph.D.                  Technical Staff 
Egenera Corp.                        pauld@egenera.com
165 Forest St., Marlboro, MA 01752       (508)858-2600

                 reply	other threads:[~2003-04-07 13:14 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=20030407092012.C13667@vienna.EGENERA.COM \
    --to=pauld@egenera.com \
    --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

all inboxes | Powered by JetHome®