From: Hannes Reinecke <hare@suse.de>
To: Christoph Hellwig <hch@lst.de>
Cc: James Bottomley <james.bottomley@hansenpartnership.com>,
Bart van Assche <bart.vanassche@sandisk.com>,
linux-scsi@vger.kernel.org, Ewan Milne <emilne@redhat.com>
Subject: Re: [PATCH 1/5] scsi: rescan VPD attributes
Date: Fri, 24 Jul 2015 16:40:42 +0200 [thread overview]
Message-ID: <55B24E6A.6030904@suse.de> (raw)
In-Reply-To: <20150724143834.GA28970@lst.de>
On 07/24/2015 04:38 PM, Christoph Hellwig wrote:
> On Wed, Jul 08, 2015 at 01:09:44PM +0200, Hannes Reinecke wrote:
>> +++ b/drivers/scsi/device_handler/scsi_dh_alua.c
>> @@ -264,8 +264,11 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h)
>> int device_id_size, device_id_type = 0;
>> struct alua_port_group *tmp_pg, *pg = NULL;
>>
>> - if (!sdev->vpd_pg83)
>> + rcu_read_lock();
>> + if (!rcu_dereference(sdev->vpd_pg83)) {
>> + rcu_read_unlock();
>> return SCSI_DH_DEV_UNSUPP;
>> + }
>>
>> /*
>> * Look for the correct descriptor.
>> @@ -281,8 +284,8 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h)
>> */
>> memset(device_id_str, 0, 256);
>> device_id_size = 0;
>> - d = sdev->vpd_pg83 + 4;
>> - while (d < sdev->vpd_pg83 + sdev->vpd_pg83_len) {
>> + d = rcu_dereference(sdev->vpd_pg83) + 4;
>> + while (d < rcu_dereference(sdev->vpd_pg83) + sdev->vpd_pg83_len) {
>
> Seem like this code would benefit from a local variable in favor of the
> repeated rcu_dereference() calls.
>
Yeah, possibly. After all, the variable isn't expected to change
under rcu_read_lock().
>> @@ -803,7 +803,7 @@ void scsi_attach_vpd(struct scsi_device *sdev)
>
> I think this function could use a new name, e.g. scsi_read_vpd_pages?
>
>> @@ -563,8 +563,9 @@ static void ses_match_to_enclosure(struct enclosure_device *edev,
>> if (!sdev->vpd_pg83_len)
>> return;
>>
>> - desc = sdev->vpd_pg83 + 4;
>> - while (desc < sdev->vpd_pg83 + sdev->vpd_pg83_len) {
>> + rcu_read_lock();
>> + desc = rcu_dereference(sdev->vpd_pg83) + 4;
>> + while (desc < rcu_dereference(sdev->vpd_pg83) + sdev->vpd_pg83_len) {
>
> A local variable or two would help here as well.
>
Okay.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (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
next prev parent reply other threads:[~2015-07-24 14:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 11:09 [PATCH 0/5] device handler interface update Hannes Reinecke
2015-07-08 11:09 ` [PATCH 1/5] scsi: rescan VPD attributes Hannes Reinecke
2015-07-24 14:38 ` Christoph Hellwig
2015-07-24 14:40 ` Hannes Reinecke [this message]
2015-07-24 14:43 ` Christoph Hellwig
2015-07-25 15:42 ` Hannes Reinecke
2015-07-08 11:09 ` [PATCH 2/5] scsi_dh: add 'rescan' callback Hannes Reinecke
2015-07-08 11:09 ` [PATCH 3/5] scsi: Add 'access_state' attribute Hannes Reinecke
2015-07-09 8:22 ` Christoph Hellwig
2015-07-09 8:43 ` Hannes Reinecke
2015-07-08 11:09 ` [PATCH 4/5] scsi_dh_alua: add 'state' callback function Hannes Reinecke
2015-07-24 14:42 ` Christoph Hellwig
2015-07-25 15:42 ` Hannes Reinecke
2015-07-08 11:09 ` [PATCH 5/5] scsi_dh_rdac: Add 'state' callback Hannes Reinecke
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=55B24E6A.6030904@suse.de \
--to=hare@suse.de \
--cc=bart.vanassche@sandisk.com \
--cc=emilne@redhat.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.