Re: [libsas PATCH v12 04/11] sysfs: handle 'parent deleted before child added'
From: Williams, Dan J <hidden>
Date: 2012-03-22 16:34:26
Also in:
linux-scsi
From: Williams, Dan J <hidden>
Date: 2012-03-22 16:34:26
Also in:
linux-scsi
On Thu, Mar 22, 2012 at 7:47 AM, James Bottomley [off-list ref] wrote:
On Wed, 2012-03-21 at 23:32 -0700, Dan Williams wrote:quoted
In scsi at least two cases of the parent device being deleted before the child is added have been observed. 1/ scsi is performing async scans and the device is removed prior to the async can thread running.This doesn't sound right. We do an explicit get on the sdkp (and the sdkp holds the sdp) before we schedule an async scan. That's only removed after the async scan has completed, so it should be impossible for the parent to vanish.
Right, the parent does not get freed because we have a reference, but it still gets device_del()'d which leads to: device_del()->kobject_del()->sysfs_remove_dir() kobj->sd = NULL; ...and then sysfs_create_dir() (without this fix) goes ahead and de-references parent_sd via sysfs_ns_type(): return (sd->s_flags & SYSFS_NS_TYPE_MASK) >> SYSFS_NS_TYPE_SHIFT; -- Dan