From: Boaz Harrosh <bharrosh@panasas.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>, open-osd <osd-dev@open-osd.org>
Subject: Re: [PATCH 4/5] osduld: Use device->release instead of internal kref
Date: Thu, 29 Oct 2009 19:24:22 +0200 [thread overview]
Message-ID: <4AE9CFC6.2080404@panasas.com> (raw)
In-Reply-To: <1256836303.7191.21.camel@mulgrave.site>
On 10/29/2009 07:11 PM, James Bottomley wrote:
> On Mon, 2009-10-26 at 18:58 +0200, Boaz Harrosh wrote:
>> @@ -335,18 +370,19 @@ static int osd_probe(struct device *dev)
>> OSD_ERR("cdev_add failed\n");
>> goto err_put_disk;
>> }
>> - kobject_get(&oud->cdev.kobj); /* 2nd ref see osd_remove() */
>>
>> /* class_member */
>> - oud->class_member = device_create(osd_sysfs_class, dev,
>> - MKDEV(SCSI_OSD_MAJOR, oud->minor), "%s", disk->disk_name);
>> + oud->class_member = device_create(&osd_uld_class, dev,
>> + MKDEV(SCSI_OSD_MAJOR, oud->minor), oud, disk->disk_name);
>> if (IS_ERR(oud->class_member)) {
>> OSD_ERR("class_device_create failed\n");
>> error = PTR_ERR(oud->class_member);
>> goto err_put_cdev;
>> }
>> + oud->save_release = oud->class_member->release;
>> + oud->class_member->release = __remove;
>
> What exactly is the reason for this iffy manipulation? Can't this be
> done properly by adding a dev_release member to osd_uld_class without
> this unnecessary and improper function chaining?
>
I tried, it does not work if I use device_create.
because in device_release(struct kobject *kobj) it has ruffly this:
if (dev->release)
dev->release(dev);
else if (class->dev_release)
class->dev_release(dev);
(See core.c:110)
so since device_create sets a dev->release = it masks out my class->dev_release
Now I have two choice. Above release chaining, or duplicate the 9 lines of code
done in device_create() before the call to device_register. I prefer the first
since it is more resilient to future core changes. (And it is less code lines)
> James
>
>
Boaz
next prev parent reply other threads:[~2009-10-29 17:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-26 16:51 [PATCHSET 0/5] osd: Revised patches for the 2.6.33 merge window Boaz Harrosh
2009-10-26 16:56 ` [PATCH 1/5] libosd: osd_dev_is_ver1 - Minor API cleanup Boaz Harrosh
2009-10-26 16:57 ` [PATCH 2/5] libosd: osd_sense: OSD_CFO_PERMISSIONS Boaz Harrosh
2009-10-26 16:57 ` [PATCH 3/5] osduld: Ref-counting bug fix Boaz Harrosh
2009-10-26 16:58 ` [PATCH 4/5] osduld: Use device->release instead of internal kref Boaz Harrosh
2009-10-29 17:11 ` James Bottomley
2009-10-29 17:24 ` Boaz Harrosh [this message]
2009-10-29 17:41 ` James Bottomley
2009-10-29 17:50 ` Boaz Harrosh
2009-10-29 18:03 ` James Bottomley
2009-10-29 18:10 ` Boaz Harrosh
2009-10-29 18:05 ` Boaz Harrosh
2009-10-29 17:58 ` Boaz Harrosh
2009-10-29 18:06 ` James Bottomley
2009-11-01 16:43 ` [PATCH 4/5 version 2] " Boaz Harrosh
2009-10-26 16:58 ` [PATCH 5/5] libosd: osd_dev_info: Unique Identification of an OSD device Boaz Harrosh
2009-11-01 16:45 ` [PATCH 5/5 version2] " Boaz Harrosh
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=4AE9CFC6.2080404@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=osd-dev@open-osd.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