From owner-cvs-all@FreeBSD.ORG Mon May 22 07:49:27 2006 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 84CB616A421; Mon, 22 May 2006 07:49:27 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 57CF443D49; Mon, 22 May 2006 07:49:27 +0000 (GMT) (envelope-from pjd@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k4M7mkl9016606; Mon, 22 May 2006 07:48:46 GMT (envelope-from pjd@repoman.freebsd.org) Received: (from pjd@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k4M7mkU1016605; Mon, 22 May 2006 07:48:46 GMT (envelope-from pjd) Message-Id: <200605220748.k4M7mkU1016605@repoman.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 22 May 2006 07:48:45 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/opencrypto crypto.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 May 2006 07:49:27 -0000 pjd 2006-05-22 07:48:45 UTC FreeBSD src repository Modified files: sys/opencrypto crypto.c Log: We must synchronize access to cc_qblocked, because there could be a race where crypto_invoke() returns ERESTART and before we set cc_qblocked to 1, crypto_unblock() is called and sets it to 0. This way we mark device as blocked forever. Fix it by not setting cc_qblocked in the fast path and by protecting crypto_invoke() in the crypto_proc thread with CRYPTO_Q_LOCK(). This won't slow things down, because there is no contention - we have only one crypto thread. Actually it can be slightly faster, because we save two atomic ops per crypto request. The fast code path remains lock-less. Revision Changes Path 1.21 +4 -17 src/sys/opencrypto/crypto.c