mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Reto Baettig <baettig@k2.llnl.gov>
To: alan@lxorguk.ukuu.org.uk (Alan Cox)
Cc: baettig@scs.ch, linux-kernel@vger.kernel.org
Subject: Re: io_request_lock question (2.2)
Date: Thu, 7 Dec 2000 17:27:56 -0800 (PST)	[thread overview]
Message-ID: <200012080127.RAA13144@k2.llnl.gov> (raw)
In-Reply-To: <E144BKn-0003EO-00@the-village.bc.nu> from "Alan Cox" at Dec 08, 2000 12:24:18 AM

> 
> > I looked at the implementation of the nbd which just calls 
> > 
> > 	spin_unlock_irq(&io_request_lock);
> > 	... do network io ...
> > 	spin_lock_irq(&io_request_lock);
> > 
> > This seems to work but it looks very dangerous to me (and ugly, too). Isn't there a better way to do this?
> 
> It is only dangerous if you unlock it in the wrong place, unlocking it as much
> as possible is good behaviour. You need it locked until you get the actual
> request off the queue, you need it locked when you complete the request. The
> rest of the time you can be polite
> 
> 

I'm sorry but I still have some doubts:

The add_request function calls 
	spin_lock_irqsave(&io_request_lock,flags); 
and then calls our request_fn which does 
	spin_unlock_irq(&io_request_lock);

	...do network I/O ...

	spin_lock_irq(&io_request_lock);
we finish the request and return to the add_request function which calls
	spin_unlock_irqrestore(&io_request_lock,flags);
and restores the flags.     

Isn't it possible now that the flags which we restore are out of date now?

Is this idiom the right one to use for 2.2?

Thanks,

Reto
-
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:[~2000-12-08  1:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-08  0:17 Reto Baettig
2000-12-08  0:24 ` Alan Cox
2000-12-08  1:27   ` Reto Baettig [this message]
2000-12-08 13:44     ` Alan Cox
2000-12-08 18:22       ` Matthew Jacob
2000-12-08 23:54         ` Alan Cox
2000-12-09  0:03           ` Matthew Jacob
2000-12-09  0:10             ` Reto Baettig
2000-12-09  0:18               ` Matthew Jacob
2000-12-09  0:14             ` Andi Kleen
2000-12-09  0:19               ` Matthew Jacob
2000-12-09  1:06                 ` Andi Kleen
2000-12-09  0:25             ` Alan Cox

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=200012080127.RAA13144@k2.llnl.gov \
    --to=baettig@k2.llnl.gov \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=baettig@scs.ch \
    --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®