Print this page
5042 stop using deprecated atomic functions
*** 291,301 ****
if (fem_create("portfop_fem",
(const struct fs_operation_def *)port_vnodesrc_template,
(fem_t **)&femp)) {
return (NULL);
}
! if (casptr(&fop_femop, NULL, femp) != NULL) {
/*
* some other thread beat us to it.
*/
fem_free(femp);
}
--- 291,301 ----
if (fem_create("portfop_fem",
(const struct fs_operation_def *)port_vnodesrc_template,
(fem_t **)&femp)) {
return (NULL);
}
! if (atomic_cas_ptr(&fop_femop, NULL, femp) != NULL) {
/*
* some other thread beat us to it.
*/
fem_free(femp);
}
*** 309,319 ****
if (fop_fsemop != NULL)
return (fop_fsemop);
if (fsem_create("portfop_fsem", port_vfssrc_template, &fsemp)) {
return (NULL);
}
! if (casptr(&fop_fsemop, NULL, fsemp) != NULL) {
/*
* some other thread beat us to it.
*/
fsem_free(fsemp);
}
--- 309,319 ----
if (fop_fsemop != NULL)
return (fop_fsemop);
if (fsem_create("portfop_fsem", port_vfssrc_template, &fsemp)) {
return (NULL);
}
! if (atomic_cas_ptr(&fop_fsemop, NULL, fsemp) != NULL) {
/*
* some other thread beat us to it.
*/
fsem_free(fsemp);
}
*** 1085,1095 ****
offsetof(portfop_t, pfop_node));
npvp->pvp_vp = vp;
/*
* If v_fopdata is not null, some other thread beat us to it.
*/
! if (casptr(&vp->v_fopdata, NULL, npvp) != NULL) {
mutex_destroy(&npvp->pvp_mutex);
list_destroy(&npvp->pvp_pfoplist);
kmem_free(npvp, sizeof (*npvp));
}
}
--- 1085,1095 ----
offsetof(portfop_t, pfop_node));
npvp->pvp_vp = vp;
/*
* If v_fopdata is not null, some other thread beat us to it.
*/
! if (atomic_cas_ptr(&vp->v_fopdata, NULL, npvp) != NULL) {
mutex_destroy(&npvp->pvp_mutex);
list_destroy(&npvp->pvp_pfoplist);
kmem_free(npvp, sizeof (*npvp));
}
}