]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
target: Fix PR registration + APTPL RCU conversion regression
authorNicholas Bellinger <nab@linux-iscsi.org>
Sun, 13 Sep 2015 09:30:46 +0000 (02:30 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Fri, 25 Sep 2015 06:17:07 +0000 (23:17 -0700)
commit3ccd6e83df8a0d4a664edeecc453c4fa046395fb
tree1c8e69d2f81bb214c545b663508364247fb699ea
parent9fd60088ffed7573c2d409ddc63a2150a5edd5d8
target: Fix PR registration + APTPL RCU conversion regression

This patch fixes a v4.2+ regression introduced by commit 79dc9c9e86
where lookup of t10_pr_registration->pr_reg_deve and associated
->pr_kref get was missing from __core_scsi3_do_alloc_registration(),
which is responsible for setting DEF_PR_REG_ACTIVE.

This would result in REGISTER operations completing successfully,
but subsequent core_scsi3_pr_seq_non_holder() checking would fail
with !DEF_PR_REG_ACTIVE -> RESERVATION CONFLICT status.

Update __core_scsi3_add_registration() to drop ->pr_kref reference
after registration and any optional ALL_TG_PT=1 processing has
completed.  Update core_scsi3_decode_spec_i_port() to release
the new parent local_pr_reg->pr_kref as well.

Also, update __core_scsi3_check_aptpl_registration() to perform
the same target_nacl_find_deve() lookup + ->pr_kref get, now that
__core_scsi3_add_registration() expects to drop the reference.

Finally, since there are cases when se_dev_entry->se_lun_acl can
still be dereferenced in core_scsi3_lunacl_undepend_item() while
holding ->pr_kref, go ahead and move explicit rcu_assign_pointer()
NULL assignments within core_disable_device_list_for_node() until
after orig->pr_comp finishes.

Reported-by: Scott L. Lykens <scott@lykens.org>
Tested-by: Scott L. Lykens <scott@lykens.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Lee Duncan <lduncan@suse.com>
Cc: <stable@vger.kernel.org> # v4.2+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_device.c
drivers/target/target_core_pr.c