Date: Tue, 26 Mar 2013 18:20:11 +0000 (UTC) From: Jim Harris <jimharris@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248731 - head/sys/dev/nvme Message-ID: <201303261820.r2QIKBvx058784@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jimharris Date: Tue Mar 26 18:20:11 2013 New Revision: 248731 URL: http://svnweb.freebsd.org/changeset/base/248731 Log: Add an internal _nvme_qpair_submit_request function, which performs the submit action assuming the qpair lock has already been acquired. Also change nvme_qpair_submit_request to just lock/unlock the mutex around a call to this new function. This fixes a recursive mutex acquisition in the retry path. Sponsored by: Intel Modified: head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Tue Mar 26 18:16:30 2013 (r248730) +++ head/sys/dev/nvme/nvme_qpair.c Tue Mar 26 18:20:11 2013 (r248731) @@ -34,6 +34,9 @@ __FBSDID("$FreeBSD$"); #include "nvme_private.h" +static void _nvme_qpair_submit_request(struct nvme_qpair *qpair, + struct nvme_request *req); + static boolean_t nvme_completion_check_retry(const struct nvme_completion *cpl) { @@ -149,7 +152,7 @@ nvme_qpair_process_completions(struct nv if (!STAILQ_EMPTY(&qpair->queued_req)) { req = STAILQ_FIRST(&qpair->queued_req); STAILQ_REMOVE_HEAD(&qpair->queued_req, stailq); - nvme_qpair_submit_request(qpair, req); + _nvme_qpair_submit_request(qpair, req); } } @@ -410,13 +413,13 @@ nvme_qpair_submit_cmd(struct nvme_qpair qpair->num_cmds++; } -void -nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) +static void +_nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) { struct nvme_tracker *tr; int err; - mtx_lock(&qpair->lock); + mtx_assert(&qpair->lock, MA_OWNED); tr = SLIST_FIRST(&qpair->free_tr); @@ -427,7 +430,7 @@ nvme_qpair_submit_request(struct nvme_qp * via a command completion. */ STAILQ_INSERT_TAIL(&qpair->queued_req, req, stailq); - goto ret; + return; } SLIST_REMOVE_HEAD(&qpair->free_tr, slist); @@ -450,7 +453,13 @@ nvme_qpair_submit_request(struct nvme_qp if (err != 0) panic("bus_dmamap_load returned non-zero!\n"); } +} -ret: +void +nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) +{ + + mtx_lock(&qpair->lock); + _nvme_qpair_submit_request(qpair, req); mtx_unlock(&qpair->lock); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303261820.r2QIKBvx058784>