Loading include/spdk/scsi.h +3 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,9 @@ struct spdk_scsi_lun { */ pthread_t thread_id; /** The reference number for this LUN, thus we can correctly free the io_channel */ uint32_t ref; /** Name for this LUN. */ char name[SPDK_SCSI_LUN_MAX_NAME_LENGTH]; Loading lib/scsi/lun.c +7 −2 Original line number Diff line number Diff line Loading @@ -395,6 +395,7 @@ int spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun *lun) { if (lun->io_channel != NULL) { if (pthread_self() == lun->thread_id) { lun->ref++; return 0; } SPDK_ERRLOG("io_channel already allocated for lun %s\n", lun->name); Loading @@ -406,13 +407,17 @@ int spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun *lun) return -1; } lun->thread_id = pthread_self(); lun->ref = 1; return 0; } void spdk_scsi_lun_free_io_channel(struct spdk_scsi_lun *lun) { if (lun->io_channel != NULL) { lun->ref--; if (lun->ref == 0) { spdk_put_io_channel(lun->io_channel); lun->io_channel = NULL; } } } Loading
include/spdk/scsi.h +3 −0 Original line number Diff line number Diff line Loading @@ -212,6 +212,9 @@ struct spdk_scsi_lun { */ pthread_t thread_id; /** The reference number for this LUN, thus we can correctly free the io_channel */ uint32_t ref; /** Name for this LUN. */ char name[SPDK_SCSI_LUN_MAX_NAME_LENGTH]; Loading
lib/scsi/lun.c +7 −2 Original line number Diff line number Diff line Loading @@ -395,6 +395,7 @@ int spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun *lun) { if (lun->io_channel != NULL) { if (pthread_self() == lun->thread_id) { lun->ref++; return 0; } SPDK_ERRLOG("io_channel already allocated for lun %s\n", lun->name); Loading @@ -406,13 +407,17 @@ int spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun *lun) return -1; } lun->thread_id = pthread_self(); lun->ref = 1; return 0; } void spdk_scsi_lun_free_io_channel(struct spdk_scsi_lun *lun) { if (lun->io_channel != NULL) { lun->ref--; if (lun->ref == 0) { spdk_put_io_channel(lun->io_channel); lun->io_channel = NULL; } } }