From patchwork Wed Feb 22 17:15:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Bauer X-Patchwork-Id: 9587253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2F0866057F for ; Wed, 22 Feb 2017 17:28:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22354285C2 for ; Wed, 22 Feb 2017 17:28:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16D40285C3; Wed, 22 Feb 2017 17:28:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17DFD285C3 for ; Wed, 22 Feb 2017 17:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932991AbdBVR1x (ORCPT ); Wed, 22 Feb 2017 12:27:53 -0500 Received: from mga03.intel.com ([134.134.136.65]:58947 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932883AbdBVR1v (ORCPT ); Wed, 22 Feb 2017 12:27:51 -0500 Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Feb 2017 09:26:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,195,1484035200"; d="scan'208";a="61181807" Received: from sbauer-z170x-ud5.lm.intel.com ([10.232.112.157]) by orsmga004.jf.intel.com with ESMTP; 22 Feb 2017 09:26:10 -0800 From: Scott Bauer To: linux-block@vger.kernel.org Cc: axboe@fb.com, keith.busch@intel.com, jonathan.derrick@intel.com, hch@lst.de, linux-nvme@lists.infradead.org, Scott Bauer Subject: [PATCH 3/3] block/sed-opal: Propagate original error message to userland. Date: Wed, 22 Feb 2017 10:15:08 -0700 Message-Id: <1487783708-16285-4-git-send-email-scott.bauer@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487783708-16285-1-git-send-email-scott.bauer@intel.com> References: <1487783708-16285-1-git-send-email-scott.bauer@intel.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP During an error on a comannd, ex: user provides wrong pw to unlock range, we will gracefully terminate the opal session. We want to propagate the original error to userland instead of the result of the session termination, which is almost always a success. Signed-off-by: Scott Bauer --- block/sed-opal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/block/sed-opal.c b/block/sed-opal.c index 020bf3e..1e18dca 100644 --- a/block/sed-opal.c +++ b/block/sed-opal.c @@ -396,8 +396,11 @@ static int next(struct opal_dev *dev) * session. Therefore we shouldn't attempt to terminate * a session, as one has not yet been created. */ - if (state > 1) - return end_opal_session_error(dev); + if (state > 1) { + end_opal_session_error(dev); + return error; + } + } state++; } while (!error);