Mercurial > illumos > illumos-gate
comparison usr/src/uts/common/io/scsi/adapters/scsi_vhci/scsi_vhci.c @ 12996:be896e318721
6897810 panic - Page fault in module "scsi_vhci" due to a NULL pointer dereference
author | Raghuram Prahlada <Raghuram.Prahlada@Sun.COM> |
---|---|
date | Mon, 02 Aug 2010 16:27:00 +0530 |
parents | 3086793bcf3c |
children |
comparison
equal
deleted
inserted
replaced
12995:03e7109ccca0 | 12996:be896e318721 |
---|---|
204 static int vhci_do_prin(struct vhci_pkt **); | 204 static int vhci_do_prin(struct vhci_pkt **); |
205 static struct scsi_pkt *vhci_create_retry_pkt(struct vhci_pkt *); | 205 static struct scsi_pkt *vhci_create_retry_pkt(struct vhci_pkt *); |
206 static struct vhci_pkt *vhci_sync_retry_pkt(struct vhci_pkt *); | 206 static struct vhci_pkt *vhci_sync_retry_pkt(struct vhci_pkt *); |
207 static struct scsi_vhci_lun *vhci_lun_lookup(dev_info_t *); | 207 static struct scsi_vhci_lun *vhci_lun_lookup(dev_info_t *); |
208 static struct scsi_vhci_lun *vhci_lun_lookup_alloc(dev_info_t *, char *, int *); | 208 static struct scsi_vhci_lun *vhci_lun_lookup_alloc(dev_info_t *, char *, int *); |
209 static void vhci_lun_free(dev_info_t *); | 209 static void vhci_lun_free(struct scsi_vhci_lun *dvlp, struct scsi_device *sd); |
210 static int vhci_recovery_reset(scsi_vhci_lun_t *, struct scsi_address *, | 210 static int vhci_recovery_reset(scsi_vhci_lun_t *, struct scsi_address *, |
211 uint8_t, uint8_t); | 211 uint8_t, uint8_t); |
212 void vhci_update_pathstates(void *); | 212 void vhci_update_pathstates(void *); |
213 | 213 |
214 #ifdef DEBUG | 214 #ifdef DEBUG |
1057 /*ARGSUSED*/ | 1057 /*ARGSUSED*/ |
1058 static void | 1058 static void |
1059 vhci_scsi_tgt_free(dev_info_t *hba_dip, dev_info_t *tgt_dip, | 1059 vhci_scsi_tgt_free(dev_info_t *hba_dip, dev_info_t *tgt_dip, |
1060 scsi_hba_tran_t *hba_tran, struct scsi_device *sd) | 1060 scsi_hba_tran_t *hba_tran, struct scsi_device *sd) |
1061 { | 1061 { |
1062 struct scsi_vhci_lun *dvlp; | |
1063 ASSERT(mdi_client_get_path_count(tgt_dip) <= 0); | |
1064 dvlp = (struct scsi_vhci_lun *)scsi_device_hba_private_get(sd); | |
1065 ASSERT(dvlp != NULL); | |
1066 | |
1067 vhci_lun_free(dvlp, sd); | |
1062 } | 1068 } |
1063 | 1069 |
1064 /* | 1070 /* |
1065 * a PGR register command has started; copy the info we need | 1071 * a PGR register command has started; copy the info we need |
1066 */ | 1072 */ |
4195 } | 4201 } |
4196 if (hba && (hba->tran_hba_flags & SCSI_HBA_TRAN_CLONE)) | 4202 if (hba && (hba->tran_hba_flags & SCSI_HBA_TRAN_CLONE)) |
4197 kmem_free(hba, sizeof (scsi_hba_tran_t)); | 4203 kmem_free(hba, sizeof (scsi_hba_tran_t)); |
4198 | 4204 |
4199 if (vlun_alloced) | 4205 if (vlun_alloced) |
4200 vhci_lun_free(tgt_dip); | 4206 vhci_lun_free(vlun, NULL); |
4201 | 4207 |
4202 return (rval); | 4208 return (rval); |
4203 } | 4209 } |
4204 | 4210 |
4205 /* ARGSUSED */ | 4211 /* ARGSUSED */ |
4265 kmem_free((caddr_t)psd, sizeof (*psd)); | 4271 kmem_free((caddr_t)psd, sizeof (*psd)); |
4266 | 4272 |
4267 mutex_destroy(&svp->svp_mutex); | 4273 mutex_destroy(&svp->svp_mutex); |
4268 cv_destroy(&svp->svp_cv); | 4274 cv_destroy(&svp->svp_cv); |
4269 kmem_free((caddr_t)svp, sizeof (*svp)); | 4275 kmem_free((caddr_t)svp, sizeof (*svp)); |
4270 | |
4271 /* | |
4272 * If this is the last path to the client, | |
4273 * then free up the vlun as well. | |
4274 */ | |
4275 if (mdi_client_get_path_count(cdip) == 1) { | |
4276 vhci_lun_free(cdip); | |
4277 } | |
4278 | 4276 |
4279 VHCI_DEBUG(4, (CE_NOTE, NULL, "!vhci_pathinfo_uninit: path=0x%p\n", | 4277 VHCI_DEBUG(4, (CE_NOTE, NULL, "!vhci_pathinfo_uninit: path=0x%p\n", |
4280 (void *)pip)); | 4278 (void *)pip)); |
4281 return (MDI_SUCCESS); | 4279 return (MDI_SUCCESS); |
4282 } | 4280 } |
7314 guid, (void *)svl)); | 7312 guid, (void *)svl)); |
7315 return (svl); | 7313 return (svl); |
7316 } | 7314 } |
7317 | 7315 |
7318 static void | 7316 static void |
7319 vhci_lun_free(dev_info_t *tgt_dip) | 7317 vhci_lun_free(struct scsi_vhci_lun *dvlp, struct scsi_device *sd) |
7320 { | 7318 { |
7321 struct scsi_vhci_lun *dvlp; | |
7322 char *guid; | 7319 char *guid; |
7323 struct scsi_device *sd; | |
7324 | |
7325 /* | |
7326 * The scsi_device was set to driver private during child node | |
7327 * initialization in the scsi_hba_bus_ctl(). | |
7328 */ | |
7329 sd = (struct scsi_device *)ddi_get_driver_private(tgt_dip); | |
7330 | |
7331 dvlp = (struct scsi_vhci_lun *) | |
7332 mdi_client_get_vhci_private(tgt_dip); | |
7333 ASSERT(dvlp != NULL); | |
7334 | |
7335 mdi_client_set_vhci_private(tgt_dip, NULL); | |
7336 | 7320 |
7337 guid = dvlp->svl_lun_wwn; | 7321 guid = dvlp->svl_lun_wwn; |
7338 ASSERT(guid != NULL); | 7322 ASSERT(guid != NULL); |
7339 VHCI_DEBUG(4, (CE_NOTE, NULL, "!vhci_lun_free: %s\n", guid)); | 7323 VHCI_DEBUG(4, (CE_NOTE, NULL, "!vhci_lun_free: %s\n", guid)); |
7340 | 7324 |