From: Hannes Reinecke Date: Mon, 24 Apr 2017 08:26:36 +0000 (+0200) Subject: scsi: sg: reset 'res_in_use' after unlinking reserved array X-Git-Tag: v4.9.47~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c47c52cde806f32c4da1e455874f6aa154c06aca;p=platform%2Fkernel%2Flinux-amlogic.git scsi: sg: reset 'res_in_use' after unlinking reserved array commit e791ce27c3f6a1d3c746fd6a8f8e36c9540ec6f9 upstream. 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. [mkp: checkpatch] Fixes: 1bc0eb044615 ("scsi: sg: protect accesses to 'reserved' page array") Signed-off-by: Hannes Reinecke Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen Cc: Todd Poynor Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index cf7e5f0..fed37aa 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -2042,6 +2042,8 @@ sg_unlink_reserve(Sg_fd * sfp, Sg_request * srp) req_schp->sglist_len = 0; sfp->save_scat_len = 0; srp->res_used = 0; + /* Called without mutex lock to avoid deadlock */ + sfp->res_in_use = 0; } static Sg_request *