public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: James Bottomley <jbottomley@parallels.com>, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] ch: add refcounting
Date: Thu, 10 Apr 2014 16:12:57 +0200	[thread overview]
Message-ID: <5346A6E9.9070801@suse.de> (raw)
In-Reply-To: <20140410115157.GA8564@infradead.org>

On 04/10/2014 01:51 PM, Christoph Hellwig wrote:
>>  static int
>>  ch_release(struct inode *inode, struct file *file)
>>  {
>>  	scsi_changer *ch = file->private_data;
>>  
>>  	scsi_device_put(ch->device);
>> +	ch->device = NULL;
>>  	file->private_data = NULL;
>> +	kref_put(&ch->ref, ch_destroy);
> 
> Any reason you need to put the scsi_device here already?  Defering
> this would give you much eaiser life time rules, and no need to
> deal with a NULL ch->device ever.
> 
Sure. But this would require a far more in-depth analysis of the
lifetime of the ch object, and most likely a far more intrusive
patch. You're welcome to do so :-)

This patch is just a minimal fix; I didn't dare to change too much
of the internals.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-04-10 14:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08  6:27 [PATCH] ch: add refcounting Hannes Reinecke
2014-04-10 11:51 ` Christoph Hellwig
2014-04-10 14:12   ` Hannes Reinecke [this message]
2014-04-25 13:17     ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2017-08-15 14:28 Hannes Reinecke
2017-08-17  1:00 ` Martin K. Petersen

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=5346A6E9.9070801@suse.de \
    --to=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.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