summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2014-01-28 17:56:30 -0800
committerNicholas Bellinger <nab@linux-iscsi.org>2014-01-30 03:58:34 -0800
commit5259a06ef97068b710f45d092a587e8d740f750f (patch)
treeda2b4c9718b41cec6e5057a3da593cc93c44759c /include
parentee291e63293146db64668e8d65eb35c97e8324f4 (diff)
downloadlinux-5259a06ef97068b710f45d092a587e8d740f750f.tar.bz2
target: Fix percpu_ref_put race in transport_lun_remove_cmd
This patch fixes a percpu_ref_put race for se_lun->lun_ref in transport_lun_remove_cmd() where ->lun_ref could end up being put more than once per command via different target completion and fabric release contexts. It adds a cmpxchg() for se_cmd->lun_ref_active to ensure that percpu_ref_put() is only ever called once per se_cmd. This bug was manifesting itself as a LUN shutdown regression bug in >= v3.13 code, where percpu_ref_kill() would end up hanging indefinately due to the incorrect percpu_ref count. (Change se_cmd->lun_ref_active from bool -> int to force at least a 4-byte cmpxchg with MIPS ll/sc ins. - Fengguang) Reported-by: Tommy Apel <tommyapeldk@gmail.com> Cc: Tommy Apel <tommyapeldk@gmail.com> Cc: <stable@vger.kernel.org> #3.13+ Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include')
-rw-r--r--include/target/target_core_base.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index d28418645b00..909dacbd230f 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -552,7 +552,7 @@ struct se_cmd {
void *priv;
/* Used for lun->lun_ref counting */
- bool lun_ref_active;
+ int lun_ref_active;
/* DIF related members */
enum target_prot_op prot_op;