]> git.baikalelectronics.ru Git - kernel.git/commit
vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT
authorNicholas Bellinger <nab@linux-iscsi.org>
Wed, 8 Oct 2014 06:19:20 +0000 (06:19 +0000)
committerNicholas Bellinger <nab@linux-iscsi.org>
Tue, 28 Oct 2014 20:54:16 +0000 (13:54 -0700)
commite78603990812d2fba9d50e1c7a6e8559bfcf1d18
treeaab2f98b7773095dcdfb799d52af64430d1a2f35
parent34bda623e6c65c97fd2e3000f42f44f200db12f6
vhost-scsi: Take configfs group dependency during VHOST_SCSI_SET_ENDPOINT

This patch addresses a bug where individual vhost-scsi configfs endpoint
groups can be removed from below while active exports to QEMU userspace
still exist, resulting in an OOPs.

It adds a configfs_depend_item() in vhost_scsi_set_endpoint() to obtain
an explicit dependency on se_tpg->tpg_group in order to prevent individual
vhost-scsi WWPN endpoints from being released via normal configfs methods
while an QEMU ioctl reference still exists.

Also, add matching configfs_undepend_item() in vhost_scsi_clear_endpoint()
to release the dependency, once QEMU's reference to the individual group
at /sys/kernel/config/target/vhost/$WWPN/$TPGT is released.

(Fix up vhost_scsi_clear_endpoint() error path - DanC)

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: <stable@vger.kernel.org> # 3.6+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/vhost/scsi.c