mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Jarod Wilson <jwilson@redhat.com>
Cc: linux1394-devel@lists.sourceforge.net,
	"Kristian Høgsberg" <krh@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH update] firewire: fix "kobject_add failed for fw* with -EEXIST"
Date: Tue, 29 Jan 2008 00:31:49 +0100	[thread overview]
Message-ID: <479E65E5.4060307@s5r6.in-berlin.de> (raw)
In-Reply-To: <479E29F2.7020307@s5r6.in-berlin.de>

I wrote:
> But the interaction with userspace processes opening /dev/fwX while the
> respective node is being shut down gave me headaches.  I am still not
> entirely sure if I got it right in the patch update, i.e. if it is free
> from deadlocks.  fw_device_shutdown() and fw_device_op_open() can be
> entered at the same time.  Would device_unregister() have to acquire a
> driver core lock which open() already took?  If yes, device_unregister()
> would be blocked on this lock while fw_device_op_open() is blocked on
> idr_rwsem.
> 
> So why did I move device_unregister() into the idr_rwsem protected
> section in the first place?  That's because I wanted to guarantee that
> fw_device_op_open() wouldn't look up a fw_device which is just in the
> process of being unregistered.  But maybe we don't even need this guarantee.

Did some further thinking:  Yes, I have to guarantee that the pointer
which the lookup in the idr tree returned is valid.

But I don't have to shove device_unregister() into the idr_rwsem locked
section.  Instead, I can (and actually should) increment the device's
refcount when I stick the device pointer into the idr tree.  (And of
course I decrease the refcount again when I remove the pointer from the
idr tree.)

Will probably post another update tomorrow.
-- 
Stefan Richter
-=====-==--- ---= ===-=
http://arcgraph.de/sr/

  reply	other threads:[~2008-01-28 23:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-27  0:05 [PATCH] " Stefan Richter
2008-01-27 17:20 ` [PATCH update] " Stefan Richter
2008-01-27 17:21   ` [PATCH] firewire: fail open() quickly if the node doesn't exist anymore Stefan Richter
2008-01-28 22:32     ` Jarod Wilson
2008-01-28 23:50       ` Stefan Richter
2008-01-28 16:48   ` [PATCH update] firewire: fix "kobject_add failed for fw* with -EEXIST" Jarod Wilson
2008-01-28 18:54     ` Stefan Richter
2008-01-28 22:24       ` Jarod Wilson
2008-01-28 19:16     ` Stefan Richter
2008-01-28 23:31       ` Stefan Richter [this message]
2008-02-02 14:01         ` [PATCH update 2] " Stefan Richter
2008-01-28 22:30   ` [PATCH update] " Jarod Wilson

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=479E65E5.4060307@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=jwilson@redhat.com \
    --cc=krh@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /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®