From: Hannes Reinecke <hare@suse.de>
To: Christoph Hellwig <hch@lst.de>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
James Bottomley <james.bottomley@hansenpartnership.com>,
Johannes Thumshirn <jth@kernel.org>,
Doug Gilberg <dgilbert@interlog.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCHv3 3/6] sg: protect accesses to 'reserved' page array
Date: Fri, 3 Feb 2017 14:38:35 +0100 [thread overview]
Message-ID: <b75d63b6-ae38-6c69-ec16-430e2bd351f7@suse.de> (raw)
In-Reply-To: <20170203133140.GC646@lst.de>
On 02/03/2017 02:31 PM, Christoph Hellwig wrote:
>> - if (sg_res_in_use(sfp)) {
>> + mutex_lock(&sfp->f_mutex);
>> + if (sfp->res_in_use) {
>> + mutex_unlock(&sfp->f_mutex);
>> sg_remove_request(sfp, srp);
>> return -EBUSY; /* reserve buffer already being used */
>> }
>> + mutex_unlock(&sfp->f_mutex);
>
> Holding a mutex over a the check of a single scalar doesn't make sense.
>
It's adds a synchronisation point, doesn't it?
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
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)
next prev parent reply other threads:[~2017-02-03 13:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 13:12 [PATCHv3 0/6] sanitize sg Hannes Reinecke
2017-02-03 13:12 ` [PATCHv3 1/6] sg: disable SET_FORCE_LOW_DMA Hannes Reinecke
2017-02-03 13:29 ` Christoph Hellwig
2017-02-03 13:12 ` [PATCHv3 2/6] sg: remove 'save_scat_len' Hannes Reinecke
2017-02-03 13:29 ` Christoph Hellwig
2017-02-03 13:12 ` [PATCHv3 3/6] sg: protect accesses to 'reserved' page array Hannes Reinecke
2017-02-03 13:31 ` Christoph Hellwig
2017-02-03 13:38 ` Hannes Reinecke [this message]
2017-02-03 16:19 ` Christoph Hellwig
2017-02-03 18:06 ` Johannes Thumshirn
2017-02-03 18:21 ` James Bottomley
2017-02-03 13:12 ` [PATCHv3 4/6] sg: check for valid direction before starting the request Hannes Reinecke
2017-02-03 13:12 ` [PATCHv3 5/6] sg: use standard lists for sg_requests Hannes Reinecke
2017-02-03 13:12 ` [PATCHv3 6/6] sg: close race condition in sg_remove_sfp_usercontext() 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=b75d63b6-ae38-6c69-ec16-430e2bd351f7@suse.de \
--to=hare@suse.de \
--cc=dgilbert@interlog.com \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=jth@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).