Re: [PATCHv2] tcmu: fix crash when removing the tcmu device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




  static void tcmu_dev_kref_release(struct kref *kref)
  {
  	struct tcmu_dev *udev = container_of(kref, struct tcmu_dev, kref);
  	struct se_device *dev = &udev->se_dev;
+	struct tcmu_cmd *cmd;
+	bool all_expired = true;
+	int i;
+
+	vfree(udev->mb_addr);
+
+	/* Upper layer should drain all requests before calling this */
+	spin_lock_irq(&udev->commands_lock);
+	idr_for_each_entry(&udev->commands, cmd, i) {
+		if (tcmu_check_and_free_pending_cmd(cmd) != 0)
+			all_expired = false;
+	}
+	idr_destroy(&udev->commands);
+	spin_unlock_irq(&udev->commands_lock);
+	WARN_ON(!all_expired);
+
+	tcmu_blocks_release(udev);
I think we also want to move the INIT_RADIX_TREE to tcmu_alloc_device.

We do not do INIT_RADIX_TREE until tcmu_configure_device and that
function might fail before the INIT call or configure might not even be
called. Right now, all the INIT does is set the rnode to NULL and the
gfp mask, so we would be ok, but if they change what happens then we
will hit problems.


Yes, will fix it.


Thanks,



--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux