From patchwork Tue Mar 21 04:21:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 9635995 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 8D256602CC for ; Tue, 21 Mar 2017 04:28:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F11C2793B for ; Tue, 21 Mar 2017 04:28:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73DE827B81; Tue, 21 Mar 2017 04:28:56 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 AE77F279E0 for ; Tue, 21 Mar 2017 04:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751790AbdCUE2x (ORCPT ); Tue, 21 Mar 2017 00:28:53 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:47345 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751083AbdCUE2u (ORCPT ); Tue, 21 Mar 2017 00:28:50 -0400 Received: from [192.168.1.66] (75-37-194-224.lightspeed.lsatca.sbcglobal.net [75.37.194.224]) (using SSLv3 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: nab) by linux-iscsi.org (Postfix) with ESMTPSA id 6F34240B09; Tue, 21 Mar 2017 04:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=linux-iscsi.org; s=default.private; t=1490070092; bh=kkRm0kyviaeY5mNJb0RLROaIII82kLd F5l8qjiX9hBQ=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To: References:Content-Type:Mime-Version:Content-Transfer-Encoding; b=BSt/I2QLA0h/KKTWyNnJS9bI77S9qxnNo62UFyu8lH1l/3gzZ0mYbrj86Ot8VgQhC a+KcWZ6xQA9YM8ufiS7rzYPh0/l/khMomz+HrrhKLzfapqCMD9YrAgFMbKkpm6sqnvQ 1dnr/f22RHkpWX9leIE3zYgsIJM4hb0QGoFT9lc= Message-ID: <1490070061.8236.16.camel@haakon3.risingtidesystems.com> Subject: Re: [PATCH 4/4] tcmu: make cmd timeout configurable From: "Nicholas A. Bellinger" To: Mike Christie Cc: target-devel@vger.kernel.org Date: Mon, 20 Mar 2017 21:21:01 -0700 In-Reply-To: <58CF6319.9060309@redhat.com> References: <1489048929-7992-1-git-send-email-mchristi@redhat.com> <1489048929-7992-5-git-send-email-mchristi@redhat.com> <1489879571.27336.17.camel@haakon3.risingtidesystems.com> <58CF6319.9060309@redhat.com> X-Mailer: Evolution 3.4.4-1 Mime-Version: 1.0 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, 2017-03-20 at 00:05 -0500, Mike Christie wrote: > On 03/18/2017 06:26 PM, Nicholas A. Bellinger wrote: > > +static ssize_t tcmu_cmd_time_out_store(struct config_item *item, const char *page, > > + size_t count) > > +{ > > > ... > > > > + > > + if (!val) { > > + pr_err("Illegal value for cmd_time_out\n"); > > + return -EINVAL; > > + } > > + > > Thanks for the patch! I tested with this chunk removed so you can > disable the timer (0 == disabled), and it all works as expected. > Thanks. Here's the last patch to drop that part, and avoid the possible divide-by-zero in the configfs attribute show handler. Btw, one other thing.. The default TCMU_TIME_OUT = 30 seconds value is still used by tcmu_queue_cmd_ring() when !is_ring_space_avail(), even when the new cmd_time_out attribute has been set to zero. AFAICT it should be using a different value than cmd_time_out, and 30 seconds default as-is seems way too high for non Linux initiators.. Perhaps this is a good canidate to become it's own TCMU backend attribute separate from cmd_time_out..? --- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index c6874c3..1d12081 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -1174,7 +1174,8 @@ static ssize_t tcmu_cmd_time_out_show(struct config_item *item, char *page) struct tcmu_dev *udev = container_of(da->da_dev, struct tcmu_dev, se_dev); - return snprintf(page, PAGE_SIZE, "%lu\n", udev->cmd_time_out / MSEC_PER_SEC); + return snprintf(page, PAGE_SIZE, "%lu\n", (!udev->cmd_time_out) ? 0: + udev->cmd_time_out / MSEC_PER_SEC); } static ssize_t tcmu_cmd_time_out_store(struct config_item *item, const char *page, @@ -1196,11 +1197,6 @@ static ssize_t tcmu_cmd_time_out_store(struct config_item *item, const char *pag if (ret < 0) return ret; - if (!val) { - pr_err("Illegal value for cmd_time_out\n"); - return -EINVAL; - } - udev->cmd_time_out = val * MSEC_PER_SEC; return count; }