The invention provides compounds of formula Ia′, Ib′, Ic′, and Id′:and pharmaceutically acceptable salts thereof, wherein the variables A, R6, R7, R8, R9, Rx, L, X, Y, and Z have the meaning as described herein. The compounds are useful for reducing endoplasmic reticulum stress and for producing analgesia in an animal.