[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.0905271255340.15613-100000@iolanthe.rowland.org>
Date: Wed, 27 May 2009 13:01:05 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: James Bottomley <James.Bottomley@...senPartnership.com>
cc: Hannes Reinecke <hare@...e.de>, Kay Sievers <kay.sievers@...y.org>,
SCSI development list <linux-scsi@...r.kernel.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...e.de>,
Kernel development list <linux-kernel@...r.kernel.org>,
Tejun Heo <tj@...nel.org>,
Cornelia Huck <cornelia.huck@...ibm.com>,
<linux-fsdevel@...r.kernel.org>,
"Eric W. Biederman" <ebiederm@...stanetworks.com>
Subject: Re: [PATCH 25/20] sysfs: Only support removing emtpy sysfs directories.
On Wed, 27 May 2009, James Bottomley wrote:
> > I don't understand all the subtle issues here. In other contexts, the
> > solution would be to initialize a refcount to 1 when the target is
> > allocated, increment it when a device is added, and decrement it when a
> > device is removed or the host is removed. When the refcount goes to 0,
> > the target is deleted. Why wouldn't this kind of approach work?
>
> Um, well that's exactly how it works (modulo the fact that there are
> parts of the lifecycle where the ref count is zero, like scanning).
Why does that happen? It's reasonable that there should be times
during scanning when the target doesn't have any children, but the
refcount should still be positive.
> The
> problem you're complaining about is that the device ref on the target
> may take a long time to release, so we can't key the del event on the
> refcount going to zero, which is what we do today.
Maybe we should be talking about two separate refcounts: a normal
get_device/put_device kref counter for the target's lifetime, and a
visibility counter (one for each child device and one overall) which
keys the del event and must go to 0 before the host removal finishes.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists