netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mitchell Blank Jr <mitch@sfgoth.com>
To: "David S. Miller" <davem@redhat.com>
Cc: chas3@users.sourceforge.net, chas@cmf.nrl.navy.mil, netdev@oss.sgi.com
Subject: Re: [RFC] add rtnl semaphore to linux-atm
Date: Fri, 3 Oct 2003 23:56:29 -0700	[thread overview]
Message-ID: <20031004065629.GA94203@gaz.sfgoth.com> (raw)
In-Reply-To: <20031004055526.GG73152@gaz.sfgoth.com>

Mitchell Blank Jr wrote:
> I'm just trying to make the point that the spinlock (or rwlock, whatever)
> can't be held when we call atm_dev->{open,close}() since they can sleep.
> Which is why we need to do the three-step process I described in the
> earlier email.

Actually I guess there's two ways of doing it... so instead of

Method 1:
  1. Take rwlock for writing
  2. Search for {dev,vpi,vci} tuple.  If found, fail - otherwise add it
     as "inactive"
  3. Drop rwlock
  4. Take semaphore
  5. Call atm_dev->open()
  6. Drop semaphore
  7. Take rwlock for writing
  8. If open succeeded clear "inactive" flag.  If failed remove entry
  9. Drop rwlock

Method 2:
  1. Take semaphore
  2. Take rwlock for reading
  3. Search for tuple, if found fail
  4. Drop rwlock
  5. Call atm_dev->open
  6. Take rwlock for writing
  7. Add tuple to list
  8. Drop rwlock
  9. Drop semaphore

The second method has the advantage that you don't need the "inactive"
flag.  On the other hand, you have to wait for the semaphore before
you can return EADDRINUSE.

-Mitch

  reply	other threads:[~2003-10-04  6:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-01 11:34 [RFC] add rtnl semaphore to linux-atm chas williams
2003-10-01 12:42 ` David S. Miller
2003-10-01 13:07   ` chas williams
2003-10-01 13:14     ` David S. Miller
2003-10-03  2:26   ` Mitchell Blank Jr
2003-10-03 13:58     ` David S. Miller
2003-10-03 21:45       ` Mitchell Blank Jr
2003-10-04  5:16         ` David S. Miller
2003-10-04  5:55           ` Mitchell Blank Jr
2003-10-04  6:56             ` Mitchell Blank Jr [this message]
2003-10-04  6:59       ` Mitchell Blank Jr
2003-10-04 12:50         ` chas williams
2003-10-04 19:42           ` Mitchell Blank Jr
2003-10-05 12:52             ` chas williams
2003-10-06  9:03               ` Mitchell Blank Jr
2003-10-06 14:46                 ` chas williams

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=20031004065629.GA94203@gaz.sfgoth.com \
    --to=mitch@sfgoth.com \
    --cc=chas3@users.sourceforge.net \
    --cc=chas@cmf.nrl.navy.mil \
    --cc=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    /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).