Date: Wed, 16 Apr 2014 10:05:36 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r264523 - stable/10/sys/cam/ctl Message-ID: <201404161005.s3GA5axE052769@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Wed Apr 16 10:05:35 2014 New Revision: 264523 URL: http://svnweb.freebsd.org/changeset/base/264523 Log: MFC r264307: Fix three refcounter leaks and lock recursion they covered. Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Wed Apr 16 10:04:19 2014 (r264522) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Wed Apr 16 10:05:35 2014 (r264523) @@ -1448,6 +1448,7 @@ cfiscsi_ioctl_handoff(struct ctl_iscsi * mtx_unlock(&cfiscsi_softc.lock); snprintf(ci->error_str, sizeof(ci->error_str), "connection not found"); ci->status = CTL_ISCSI_ERROR; + cfiscsi_target_release(ct); return; } mtx_unlock(&cfiscsi_softc.lock); @@ -2086,15 +2087,9 @@ cfiscsi_target_hold(struct cfiscsi_targe static void cfiscsi_target_release(struct cfiscsi_target *ct) { - int old; struct cfiscsi_softc *softc; softc = ct->ct_softc; - - old = ct->ct_refcount; - if (old > 1 && atomic_cmpset_int(&ct->ct_refcount, old, old - 1)) - return; - mtx_lock(&softc->lock); if (refcount_release(&ct->ct_refcount)) { TAILQ_REMOVE(&softc->targets, ct, ct_next); @@ -2271,6 +2266,7 @@ cfiscsi_lun_enable(void *arg, struct ctl tmp = strtoul(lun, NULL, 10); cfiscsi_target_set_lun(ct, tmp, lun_id); + cfiscsi_target_release(ct); return (0); } @@ -2290,8 +2286,9 @@ cfiscsi_lun_disable(void *arg, struct ct continue; if (ct->ct_luns[i] != lun_id) continue; + mtx_unlock(&softc->lock); cfiscsi_target_unset_lun(ct, i); - break; + return (0); } } mtx_unlock(&softc->lock);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404161005.s3GA5axE052769>