From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
James Bottomley <james.bottomley@hansenpartnership.com>,
Johannes Thumshirn <jth@kernel.org>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
Hannes Reinecke <hare@suse.com>
Subject: [PATCH] sg: reset 'res_in_use' after unlinking reserved array
Date: Mon, 24 Apr 2017 10:26:36 +0200 [thread overview]
Message-ID: <1493022396-107620-1-git-send-email-hare@suse.de> (raw)
Once the reserved page array is unused we can reset the
'res_in_use' state; here we can do a lazy update without
holding the mutex as we only need to check against
concurrent access, not concurrent release.
Fixes: 1bc0eb0 ("scsi: sg: protect accesses to 'reserved' page array")
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/sg.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 8147147..06503c1 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -2056,6 +2056,8 @@ static long sg_compat_ioctl(struct file *filp, unsigned int cmd_in, unsigned lon
req_schp->page_order = 0;
req_schp->sglist_len = 0;
srp->res_used = 0;
+ /* Called without mutex lock to avoid deadlock */
+ sfp->res_in_use = 0;
}
static Sg_request *
--
1.8.5.6
next reply other threads:[~2017-04-24 8:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-24 8:26 Hannes Reinecke [this message]
2017-04-24 8:32 ` [PATCH] sg: reset 'res_in_use' after unlinking reserved array Johannes Thumshirn
2017-04-24 15:30 ` Christoph Hellwig
2017-04-24 22:20 ` 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=1493022396-107620-1-git-send-email-hare@suse.de \
--to=hare@suse.de \
--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 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.