aboutsummaryrefslogtreecommitdiff
path: root/sys/cam
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2018-01-29 18:07:14 +0000
committerWarner Losh <imp@FreeBSD.org>2018-01-29 18:07:14 +0000
commitde4f4237bf94e6645d0b56af8d85751033fe5138 (patch)
tree17a2e773abbfbad3dd3a02274794d384ac94a23c /sys/cam
parent68f18f30d179fff48a961de9741bce4fa8e8615c (diff)
downloadsrc-de4f4237bf94e6645d0b56af8d85751033fe5138.tar.gz
src-de4f4237bf94e6645d0b56af8d85751033fe5138.zip
Do the book-keeping on release before we release the reference. The
periph was going away on final release, and then returning and we started dancing in free memory. Sponsored by: Netflix
Notes
Notes: svn path=/head/; revision=328554
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/scsi/scsi_da.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 11637f751e9b..9c5cb1368870 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -1549,12 +1549,12 @@ da_periph_unhold(struct cam_periph *periph, da_ref_token token)
struct da_softc *softc = periph->softc;
token_sanity(token);
- cam_periph_unhold(periph);
DA_PERIPH_PRINT(periph, "Unholding device %s (%d)\n",
da_ref_text[token], token);
cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1);
if (cnt != 1)
panic("Unholding %d with cnt = %d", token, cnt);
+ cam_periph_unhold(periph);
}
static inline int
@@ -1583,12 +1583,12 @@ da_periph_release(struct cam_periph *periph, da_ref_token token)
struct da_softc *softc = periph->softc;
token_sanity(token);
- cam_periph_release(periph);
DA_PERIPH_PRINT(periph, "releasing device %s (%d)\n",
da_ref_text[token], token);
cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1);
if (cnt != 1)
panic("Releasing %d with cnt = %d", token, cnt);
+ cam_periph_release(periph);
}
static inline void
@@ -1598,12 +1598,12 @@ da_periph_release_locked(struct cam_periph *periph, da_ref_token token)
struct da_softc *softc = periph->softc;
token_sanity(token);
- cam_periph_release_locked(periph);
DA_PERIPH_PRINT(periph, "releasing device (locked) %s (%d)\n",
da_ref_text[token], token);
cnt = atomic_fetchadd_int(&softc->ref_flags[token], -1);
if (cnt != 1)
panic("Unholding %d with cnt = %d", token, cnt);
+ cam_periph_release_locked(periph);
}
#define cam_periph_hold POISON