From nobody Thu Feb 10 19:43:43 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 727B719A93B2; Thu, 10 Feb 2022 19:43:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JvnHM2nDtz3Gk5; Thu, 10 Feb 2022 19:43:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644522223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3ph7l7c4vNy04fnBKUxIShBifoGAbOM9ZXMFw4jOrnQ=; b=OHRmnTvXjtQZwPM/qoC+UnOrwf2gSrqIKYfgvj8JvRi7cfQvnoAxUlxihqXglhnTrVd2zZ LLii2rgjgpXXeTD3VvKqTD6LHo/Rw0GE8wn/aoYH5WTCAggDDBLphmKmL/dsEIv/by8bbo TEEgg+bFICZvF56hUxaTazsPgS+Syx6iqADRYUiNX3EcHYkE6GngpLc/yXdxCpRb92Dfsd d7nLbkWM+lH4Pej5HTQ1xUHUGX27dvACc5bWL9jCvCm3nZug/+eePnwvphmSykLe7oc8OV n5uyHX9uHPxzXwPKOm/QsmVnAYcMSKFHhEUGFa7QR6zXSflCFAEW502HEP3V4w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F07B264B3; Thu, 10 Feb 2022 19:43:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21AJhhfC035363; Thu, 10 Feb 2022 19:43:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21AJhh2j035362; Thu, 10 Feb 2022 19:43:43 GMT (envelope-from git) Date: Thu, 10 Feb 2022 19:43:43 GMT Message-Id: <202202101943.21AJhh2j035362@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Wing Subject: git: 583480174ee7 - stable/13 - cam: don't lock while handling an AC_UNIT_ATTENTION List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 583480174ee7f4af92f0c5302884a7eece5b12f3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644522223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3ph7l7c4vNy04fnBKUxIShBifoGAbOM9ZXMFw4jOrnQ=; b=VtiGW+1OraLJhUKy6DzNSo9Li5igoIIPFRWuu4Pf5n5HV7E4uyQyGqpk+sOKcpoclPfRQP llLNuqbvFuOqgH+VAkcq4qrrfcD8opnJfMZFzndhe0Z9Ym9p6ODvM1EG+DYctzCxnZkXpt Ap8a4SahtB2T7NIXCqbRgUmd91qCcBZj+dHobmJot6ez7MBRyhMGzCpSMvLNPTkm6thrQf ACtXIDC7n3wSlUL8CrYhIgfuU/ny/MDuTp5iRaQnaVrnFt7sxyhTQosJ4f/nEdG5yZmaEr WnjM3I2z1q7mYQpLCNMClFZxKE9iGUk3v9jaE26YhIfCwZ8AnEXKRFry+IKqrw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644522223; a=rsa-sha256; cv=none; b=qi76m4FLVf9J3t76biNOXWa7b7YYF9emzXJmCABq7fNRz/eMJqtoR88Guzt1G+x02UCRBF Y7psCJmbB7wGwfPFLgxule9X5C7GHfPwviE76BDz0yhvRknohCACjWfAI9V4R8EDGsr2o8 42pRmAXWiQxy6H0ux3Zdnkr9SUPs8S3uP8TChmdB+Yfz1Vcrc6QShzaFVGGylyvi11nrm/ QraD0+WzMBdZMO5OXfJqX3/BeKTeEtBMwslJFoju7xT4ygqiPgQVS804bQU5CZODABeFBv X3cvAO/r/abQh2vjWBltGdVOwmgmuNpYQBTS/tRNpt7R9jwXS9Xq6Q718lUhqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=583480174ee7f4af92f0c5302884a7eece5b12f3 commit 583480174ee7f4af92f0c5302884a7eece5b12f3 Author: Robert Wing AuthorDate: 2022-01-04 01:21:58 +0000 Commit: Robert Wing CommitDate: 2022-02-10 19:43:18 +0000 cam: don't lock while handling an AC_UNIT_ATTENTION Don't take the device_mtx lock in daasync() when handling an AC_UNIT_ATTENTION. Instead, assert the lock is held before modifying the periph's softc flags. The device_mtx lock is taken in xptdevicetraverse() before daasync() is eventually called in xpt_async_bcast(). PR: 240917, 226510, 226578 Reviewed by: imp MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D27735 (cherry picked from commit bb8441184bab60cd8a07c2b94bd6c4ae8b56ec25) --- sys/cam/scsi/scsi_da.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index f710e82eda9b..8b1e1c0e0d46 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -2150,7 +2150,7 @@ daasync(void *callback_arg, u_int32_t code, } break; } - case AC_UNIT_ATTENTION: + case AC_UNIT_ATTENTION: /* Called for this path: periph locked */ { union ccb *ccb; int error_code, sense_key, asc, ascq; @@ -2160,9 +2160,7 @@ daasync(void *callback_arg, u_int32_t code, /* * Handle all UNIT ATTENTIONs except our own, as they will be - * handled by daerror(). Since this comes from a different periph, - * that periph's lock is held, not ours, so we have to take it ours - * out to touch softc flags. + * handled by daerror(). */ if (xpt_path_periph(ccb->ccb_h.path) != periph && scsi_extract_sense_ccb(ccb, @@ -2170,22 +2168,19 @@ daasync(void *callback_arg, u_int32_t code, if (asc == 0x2A && ascq == 0x09) { xpt_print(ccb->ccb_h.path, "Capacity data has changed\n"); - cam_periph_lock(periph); + cam_periph_assert(periph, MA_OWNED); softc->flags &= ~DA_FLAG_PROBED; dareprobe(periph); - cam_periph_unlock(periph); } else if (asc == 0x28 && ascq == 0x00) { - cam_periph_lock(periph); + cam_periph_assert(periph, MA_OWNED); softc->flags &= ~DA_FLAG_PROBED; - cam_periph_unlock(periph); disk_media_changed(softc->disk, M_NOWAIT); } else if (asc == 0x3F && ascq == 0x03) { xpt_print(ccb->ccb_h.path, "INQUIRY data has changed\n"); - cam_periph_lock(periph); + cam_periph_assert(periph, MA_OWNED); softc->flags &= ~DA_FLAG_PROBED; dareprobe(periph); - cam_periph_unlock(periph); } } break;