Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4457705imu; Sat, 19 Jan 2019 09:48:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Gi+wvtOXlYXMC68J1UPwlGdMo5c+KrVJJ1GmaIsHVrLggbb93UP5X14qm+Khj3to6wfVM X-Received: by 2002:a62:3a04:: with SMTP id h4mr23806215pfa.119.1547920092469; Sat, 19 Jan 2019 09:48:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547920092; cv=none; d=google.com; s=arc-20160816; b=vi1UT9Hm8slilrzYc1K3FvaAwYZhKB/pI7z8jkMbhNSjIbUnDScyQnViQUUl+4t2xM iOqqVj2yH8KAMFXb6s46gHknCtPG4HO0hahBu2foTSdU/hVsdmLePjoyFN5O8xgsV04g nvpKtQP0gyyn/EBu+eL/dJQ3My+BksS7iDm0z6JeokSz0LMnTOigIN5AkCp63cQ6wYZD nZhtXKBowKRRUla9+Tjy5CBgNQKl8IVwXJAILGh4Cm7vh3J+eHMYJbb3jKx22sKuBqWf Nhpc58c8xeGtPzxvPGkeYUEFTftAS6OW6mRjEtM5LrZtplRCATMIeGQdBNPeSSojjSjy ZzJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:cc:to:from :date; bh=t5oZhVelpji1d0/doPBgOw8d+XyyUXAbAN7kI5w8NTU=; b=JBG0dvgJuViuFypT9dQHKJOjgzxCFuDuszSA6XGo3JtsbhvyE94bhBa8tQlG3mepI9 CXFUr1BOvlfQjqQOUMi7K/zkfyDu1Wb5p3pefQSglnMLuI/2pZm+tRcKGy8INtnOdP8C rWup54VmnIjp92XI695+Ge5xaq8iuGkIrtOYxlXJGnTrqgFDNQeicvITC5CWerklJGZ9 YKnujoSmdU3AerLJJmghyPG/Mjf45X0r7HN3YaALMqJuGAFGhkPZfrHEQBmtaiesvMLQ WqtthP3KdhBHWm+YwIIlLzIqxWoWaz6wPuHogCbs7ZHFynMSoYizAbnzGG6WfaVyrlHI sxmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s2si7953394pgr.285.2019.01.19.09.47.56; Sat, 19 Jan 2019 09:48:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728848AbfASRqm (ORCPT + 99 others); Sat, 19 Jan 2019 12:46:42 -0500 Received: from bout01.mta.xmission.com ([166.70.11.15]:38068 "EHLO bout01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728658AbfASRqm (ORCPT ); Sat, 19 Jan 2019 12:46:42 -0500 Received: from mx02.mta.xmission.com ([166.70.13.212]) by bout01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1gkuhc-00069C-6e; Sat, 19 Jan 2019 10:46:40 -0700 Received: from plesk14-shared.xmission.com ([166.70.198.161] helo=plesk14.xmission.com) by mx02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1gkuhb-0005HM-Md; Sat, 19 Jan 2019 10:46:40 -0700 Received: from hacktheplanet (unknown [73.58.156.101]) by plesk14.xmission.com (Postfix) with ESMTPSA id D2D072119B7; Sat, 19 Jan 2019 17:46:38 +0000 (UTC) Date: Sat, 19 Jan 2019 12:46:33 -0500 From: Scott Bauer To: David Kozub Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, hch@infradead.org, jonathan.derrick@intel.com Message-ID: <20190119174633.GA15276@hacktheplanet> References: <1547760716-7304-16-git-send-email-zub@linux.fjfi.cvut.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1547760716-7304-16-git-send-email-zub@linux.fjfi.cvut.cz> User-Agent: Mutt/1.9.4 (2018-02-28) X-XM-SPF: eid=1gkuhb-0005HM-Md;;;mid=<20190119174633.GA15276@hacktheplanet>;;;hst=mx02.mta.xmission.com;;;ip=166.70.198.161;;;frm=sbauer@plzdonthack.me;;;spf=none X-SA-Exim-Connect-IP: 166.70.198.161 X-SA-Exim-Mail-From: sbauer@plzdonthack.me X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa07.xmission.com X-Spam-Level: X-Spam-Status: No, score=0.2 required=8.0 tests=ALL_TRUSTED,BAYES_40, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, T_TooManySym_02,T_TooManySym_03,XMSubLong,XM_UncommonTLD01 autolearn=disabled version=3.4.2 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 BAYES_40 BODY: Bayes spam probability is 20 to 40% * [score: 0.3003] * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 0.5 XM_UncommonTLD01 Less-common TLD * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.0 T_TooManySym_03 6+ unique symbols in subject X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;David Kozub X-Spam-Relay-Country: X-Spam-Timing: total 310 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.3 (1.1%), b_tie_ro: 2.3 (0.8%), parse: 1.16 (0.4%), extract_message_metadata: 5 (1.7%), get_uri_detail_list: 1.99 (0.6%), tests_pri_-1000: 3.7 (1.2%), tests_pri_-950: 1.43 (0.5%), tests_pri_-900: 1.15 (0.4%), tests_pri_-90: 20 (6.3%), check_bayes: 18 (5.7%), b_tokenize: 7 (2.1%), b_tok_get_all: 5 (1.7%), b_comp_prob: 1.78 (0.6%), b_tok_touch_all: 2.4 (0.8%), b_finish: 0.68 (0.2%), tests_pri_0: 260 (84.0%), check_dkim_signature: 0.51 (0.2%), check_dkim_adsp: 7 (2.2%), poll_dns_idle: 0.79 (0.3%), tests_pri_10: 3.2 (1.0%), tests_pri_500: 8 (2.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v2 15/16] block: sed-opal: don't repeat opal_discovery0 in each steps array X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Fri, 13 May 2016 17:07:30 -0600) X-SA-Exim-Scanned: Yes (on mx02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 17, 2019 at 09:31:55PM +0000, David Kozub wrote: > - for (state = 0; !error && state < n_steps; state++) { > - step = &steps[state]; > - > - error = step->fn(dev, step->data); > - if (error) { > - pr_debug("Step %zu (%pS) failed with error %d: %s\n", > - state, step->fn, error, > - opal_error_to_human(error)); > - > - /* For each OPAL command we do a discovery0 then we > - * start some sort of session. > - * If we haven't passed state 1 then there was an error > - * on discovery0 or during the attempt to start a > - * session. Therefore we shouldn't attempt to terminate > - * a session, as one has not yet been created. > - */ > - if (state > 1) { > - end_opal_session_error(dev); > - return error; > - } > + /* first do a discovery0 */ > + error = opal_discovery0_step(dev); > > - } > - } > + for (state = 0; !error && state < n_steps; state++) > + error = execute_step(dev, &steps[state], state); > + > + /* For each OPAL command the first step in steps starts some sort > + * of session. If an error occurred in the initial discovery0 or if > + * an error stopped the loop in state 0 then there was an error > + * before or during the attempt to start a session. Therefore we > + * shouldn't attempt to terminate a session, as one has not yet > + * been created. > + */ > + if (error && state > 0) > + end_opal_session_error(dev); This is subtly wrong. There was some state that was encoded by having the loop the way we did. the tl;dr is the check needs to be if (error && state > 1) still. The why is that in the previous implementation we wanted to end_opal_session_error only if a successful discovery0 AND a successful start_*_session. In the previous loop, discovery0 would complete, we'd do state++, then we'd go and attempt to start our session. If we failed on that session starting we'd still be in state 1, and wouldn't attempt to close the session. In the current form, discovery0 is gone, so start session is on state 0. If we fail on the start session, we set error = true, state gets ++'d, then we look at !error and we don't loop again. We go down to the check and attempt to end a session that was never started. > -- > 2.20.1 > >