All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Seymour, Shane M" <shane.seymour@hpe.com>,
	"Martin K. Petersen" <martin.Petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	James Bottomley <jbottomley@odin.com>,
	Johannes Thumshirn <jthumshirn@suse.com>
Subject: Re: [PATCH] scsi: rescan VPD attributes
Date: Thu, 26 Nov 2015 08:08:47 +0100	[thread overview]
Message-ID: <5656AFFF.3080403@suse.de> (raw)
In-Reply-To: <DDB9C85B850785449757F9914A034FCB444E0362@G4W3219.americas.hpqcorp.net>

On 11/26/2015 06:07 AM, Seymour, Shane M wrote:
> Hi Hannes,
> 
> I have one probably small nitpick about the patch. I'm not sure how likely what I've put below is likely
> to happen in real life though.
> 
> Is there any chance at all that sdev->vpd_pg83_len could change when updated?
> If there's any chance of that I'd have expected that both the
length of and the pointer to the vpd data
> would need to be protected not just the pointer so someone would
have a consistent picture of the vpd
> and its length. Without that there is a race where someone could
be using a new length with the old vpd
> data. That leaves the potential for a length that exceeds the vpd
size if the new data is larger than
> the old data - I don't know how likely it is but wanted to at
least bring it up as something to consider.
> 
Accesses to vpd_pgXX are rcu-protected, so we're ensured that we
always see a _valid_ copy. And we know that integer updates are
atomic, so we will always see a valid number in vpd_pgXX_len.
Both, vpd_pgXX and vpd_pgXX_len, are updated at the same place, and
under the same locks/mutexes. And as we're calling
'synchronize_rcu()' after updating vpd_pgXX, which needs to
synchronize against all CPUs, I would think that this would take
care of updating vpd_pgXX_len, too.

But you are right, we can get rid of vpd_pgXX_len and calculate it
from the data.
However, I'd like to do this with another patch after the ALUA
changes are in.

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

  reply	other threads:[~2015-11-26  7:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09 12:24 [PATCH] scsi: rescan VPD attributes Hannes Reinecke
2015-11-26  3:34 ` Martin K. Petersen
2015-11-26  5:07 ` Seymour, Shane M
2015-11-26  7:08   ` Hannes Reinecke [this message]
2015-11-26  7:50 ` Johannes Thumshirn
2015-11-26  9:50 ` Seymour, Shane M
2015-11-30 16:41 ` 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=5656AFFF.3080403@suse.de \
    --to=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jbottomley@odin.com \
    --cc=jthumshirn@suse.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.Petersen@oracle.com \
    --cc=shane.seymour@hpe.com \
    /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.