]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: target: Fix LUN ref count handling
authorMike Christie <michael.christie@oracle.com>
Sun, 1 Nov 2020 18:59:27 +0000 (12:59 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 5 Nov 2020 03:39:37 +0000 (22:39 -0500)
commit813dbf32eacdc6fdea78e42db75fec455264a25b
treedb61b51f246195b2a85d59e6e3de4d056d5c1925
parentea74de3ce2ef7cb4ac090de5c13116b6bc269d3c
scsi: target: Fix LUN ref count handling

Fix two bugs in the LUN refcounting:

 1. For the TCM_WRITE_PROTECTED case we were returning an error after
    taking a ref to the LUN, but never dropping it (caller just send status
    and drops cmd ref).

 2. We still need to do a percpu_ref_tryget_live for the virt LUN 0 like we
    do for other LUNs, because the TPG code does the refcount/wait process
    like it does with other LUNs.

Link: https://lore.kernel.org/r/1604257174-4524-2-git-send-email-michael.christie@oracle.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/target/target_core_device.c