mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linas Vepstas <linas@austin.ibm.com>
To: Paul Mackerras <paulus@samba.org>
Cc: akpm@osdl.org, anton@samba.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PPC64 Fix unbalanced pci_dev_put in EEH code
Date: Thu, 19 Aug 2004 10:35:16 -0500	[thread overview]
Message-ID: <20040819153516.GM14002@austin.ibm.com> (raw)
In-Reply-To: <16675.64654.945327.265586@cargo.ozlabs.ibm.com>

On Thu, Aug 19, 2004 at 11:04:14AM +1000, Paul Mackerras was heard to remark:
> Linas Vepstas writes:
> 
> > Hang on there, you didn't just rename the variable, you also missed a
> > teeny chunk of the original patch.  The corrected path is attached below.
> > (Well, I rather liked my original var names better, but whatever).
> 
> Look closer, I didn't miss the chunk, I solved the race condition that
> you mentioned. :)  I did if (!inserted) pci_dev_put(dev) at the end
> rather than if (inserted) pci_dev_get(dev).

OK, I missed the !  (which is why I like !=0 because that avoids
single-char errors from ruinging things.)

That will work.

There's no race, since the for-each-device loop performs a pci_dev_get
which holds on to the device for the duration of the loop interior.
So doing a dev_get at any time inside the loop is sufficient; no
ordering is required.

(One of my original errors was assuming that I had to do a dev_put at the
bottom of the loop to counteract the for-each-device's get; but, no, 
this is not needed, the for-each-device loop performs a dev-put at 
the end of the loop, just as it does a dev_get for the next iteration.)

--linas

      reply	other threads:[~2004-08-19 22:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-18  3:43 Paul Mackerras
2004-08-18 17:25 ` Linas Vepstas
2004-08-19  1:04   ` Paul Mackerras
2004-08-19 15:35     ` Linas Vepstas [this message]

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=20040819153516.GM14002@austin.ibm.com \
    --to=linas@austin.ibm.com \
    --cc=akpm@osdl.org \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.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®