Fix for WITNESS warning while doing xpt_rescan.

This happen when converting any JBOD to RAID or creating
any new RAID from Unconfigured Drives.

Without this fix, user may see below call trace if  WITNESS is enabled.

witness_warn() at witness_warn+0x4b5/frame 0xfffffe011f929a00
uma_zalloc_arg() at uma_zalloc_arg+0x3b/frame 0xfffffe011f929a70
malloc() at malloc+0x192/frame 0xfffffe011f929ac0
mrsas_bus_scan_sim() at mrsas_bus_scan_sim+0x32/frame 0xfffffe011f929af0
mrsas_aen_handler() at mrsas_aen_handler+0x11c/frame 0xfffffe011f929b20
taskqueue_run_locked() at taskqueue_run_locked+0xf0/frame 0xfffffe011f929b80
taskqueue_thread_loop() at taskqueue_thread_loop+0x9b/frame 0xfffffe011f929bb0
fork_exit() at fork_exit+0x84/frame 0xfffffe011f929bf0
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe011f929bf0

Submitted by:   kadesai
Reviewed by:    ambrisko
MFC after:      3 days
This commit is contained in:
Kashyap D Desai 2014-09-02 18:32:41 +00:00
parent 585bf8ae67
commit 49328cc39c
2 changed files with 5 additions and 8 deletions

View File

@ -101,7 +101,7 @@ __FBSDID("$FreeBSD$");
*/
#define BYTE_ALIGNMENT 1
#define MRSAS_MAX_NAME_LENGTH 32
#define MRSAS_VERSION "06.704.01.00-fbsd"
#define MRSAS_VERSION "06.704.01.01-fbsd"
#define MRSAS_ULONG_MAX 0xFFFFFFFFFFFFFFFF
#define MRSAS_DEFAULT_TIMEOUT 0x14 //temp
#define DONE 0

View File

@ -1116,18 +1116,16 @@ int mrsas_bus_scan(struct mrsas_softc *sc)
union ccb *ccb_0;
union ccb *ccb_1;
mtx_lock(&sc->sim_lock);
if ((ccb_0 = xpt_alloc_ccb()) == NULL) {
mtx_unlock(&sc->sim_lock);
return(ENOMEM);
}
if ((ccb_1 = xpt_alloc_ccb()) == NULL) {
xpt_free_ccb(ccb_0);
mtx_unlock(&sc->sim_lock);
return(ENOMEM);
}
mtx_lock(&sc->sim_lock);
if (xpt_create_path(&ccb_0->ccb_h.path, xpt_periph, cam_sim_path(sc->sim_0),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP){
xpt_free_ccb(ccb_0);
@ -1144,9 +1142,9 @@ int mrsas_bus_scan(struct mrsas_softc *sc)
return(EIO);
}
mtx_unlock(&sc->sim_lock);
xpt_rescan(ccb_0);
xpt_rescan(ccb_1);
mtx_unlock(&sc->sim_lock);
return(0);
}
@ -1161,19 +1159,18 @@ int mrsas_bus_scan_sim(struct mrsas_softc *sc, struct cam_sim *sim)
{
union ccb *ccb;
mtx_lock(&sc->sim_lock);
if ((ccb = xpt_alloc_ccb()) == NULL) {
mtx_unlock(&sc->sim_lock);
return(ENOMEM);
}
mtx_lock(&sc->sim_lock);
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP){
xpt_free_ccb(ccb);
mtx_unlock(&sc->sim_lock);
return(EIO);
}
xpt_rescan(ccb);
mtx_unlock(&sc->sim_lock);
xpt_rescan(ccb);
return(0);
}