From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBovDCVlUHRHsWGaXi6AHybOmK1FDyNB/Q80/XmmXcDftakftaunsstyJl3vs1b1dsRoCwn7W ARC-Seal: i=1; a=rsa-sha256; t=1516203217; cv=none; d=google.com; s=arc-20160816; b=Vg90tJLVtOhmJW0fN1ndwgOVrnC4vNit4bhYQufQYMQ9jTlMRRYOrpW34HOAKvr8Uu bwkBT40BRvzk7KxdKoOhD7K+KCXB6pScaK4hwbZYr7TlIGVpe09sGUeyZT6h/diaC8mC gMRpztoN5OJpjoNOEfrUmrLabgQKD7Ga7oNTsyJhPlUQHHsJ3o9QnIaVhRPkVvzWYA/o NemKZR3njKhruAo2ETqeqZzFFupoenfRxBeGOiU5Of4HlPTfLn3+/Nf8741HS8XiVPPC 0QJEimF7BHsH7+Pqs9SpSLMK6zondX92zC8DGZV1am0Ov8SzA9K+tN00yCK7oRyVlK6F lHkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:message-id:in-reply-to:subject :cc:to:from:date:dkim-signature:arc-authentication-results; bh=LQhCQ+q1H/s2LDgZ8kPKXaxS4VRQLgn4IeAKddIoL04=; b=SYzSpKKToH/T3iIBF0zSFehIKAzTkgHZTuMp5mUnJVJbEGWU7DY5ZXCPBNlbTmDvgQ q3cEj2vftA8XvG4TIkjK4YlLhRpxloR/Yv2/8pvGTecZlvXoJ5jZdbeWL4t8Z2snDUvR oS8e/U9C1RL4JliexcQJstPXmccUp9R6/X9HwbSlt9a0GQLMCvsM1HL7M5lO259Cient C+GP6m9txbJUOvWgR8X6+f++na9FgwFpG4FPp4v9jdMp8YggvpgqDRyThQDpHsOdzAJ0 9KpDCrfCEGe5LglvuWZI4D8KLgpBuxW35V7Wt3HKIgU5NSfbPegZ99jY6rrptraBmUu0 xAgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=LoOwUeT0; spf=pass (google.com: best guess record for domain of jsimmons@infradead.org designates 2001:8b0:10b:1236::1 as permitted sender) smtp.mailfrom=jsimmons@infradead.org Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=LoOwUeT0; spf=pass (google.com: best guess record for domain of jsimmons@infradead.org designates 2001:8b0:10b:1236::1 as permitted sender) smtp.mailfrom=jsimmons@infradead.org Date: Wed, 17 Jan 2018 15:33:32 +0000 (GMT) From: James Simmons To: NeilBrown cc: Oleg Drokin , Andreas Dilger , Greg Kroah-Hartman , lkml , lustre Subject: Re: [PATCH 12/19] staging: lustre: make polling loop in ptlrpc_unregister_bulk more obvious In-Reply-To: <151538209376.23920.7787678507188073174.stgit@noble> Message-ID: References: <151538168618.23920.8261096424342988792.stgit@noble> <151538209376.23920.7787678507188073174.stgit@noble> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180117_153333_012748_00F3C369 X-CRM114-Status: GOOD ( 15.08 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 NO_RELAYS Informational: message was not relayed via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1588993444639091892?= X-GMAIL-MSGID: =?utf-8?q?1589854304896662924?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: > This use of l_wait_event() is a polling loop that re-checks > every second. Make this more obvious with a while loop > and wait_event_idle_timeout(). Reviewed-by: James Simmons > Signed-off-by: NeilBrown > --- > drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c > index 0c2ded721c49..86883abaad2c 100644 > --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c > +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c > @@ -229,7 +229,6 @@ int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async) > { > struct ptlrpc_bulk_desc *desc = req->rq_bulk; > wait_queue_head_t *wq; > - struct l_wait_info lwi; > int rc; > > LASSERT(!in_interrupt()); /* might sleep */ > @@ -246,7 +245,7 @@ int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async) > > /* the unlink ensures the callback happens ASAP and is the last > * one. If it fails, it must be because completion just happened, > - * but we must still l_wait_event() in this case to give liblustre > + * but we must still wait_event() in this case to give liblustre > * a chance to run client_bulk_callback() > */ > mdunlink_iterate_helper(desc->bd_mds, desc->bd_md_max_brw); > @@ -270,15 +269,17 @@ int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async) > /* Network access will complete in finite time but the HUGE > * timeout lets us CWARN for visibility of sluggish LNDs > */ > - lwi = LWI_TIMEOUT_INTERVAL(LONG_UNLINK * HZ, > - HZ, NULL, NULL); > - rc = l_wait_event(*wq, !ptlrpc_client_bulk_active(req), &lwi); > - if (rc == 0) { > + int cnt = 0; > + while (cnt < LONG_UNLINK && > + (rc = wait_event_idle_timeout(*wq, > + !ptlrpc_client_bulk_active(req), > + HZ)) == 0) > + cnt += 1; > + if (rc > 0) { > ptlrpc_rqphase_move(req, req->rq_next_phase); > return 1; > } > > - LASSERT(rc == -ETIMEDOUT); > DEBUG_REQ(D_WARNING, req, "Unexpectedly long timeout: desc %p", > desc); > } > > >