From patchwork Tue Jan 24 04:52:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 718884 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3v6wmF3ZwWz9sxN for ; Tue, 24 Jan 2017 15:53:01 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="BxkrYZgh"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3v6wmF2SVhzDqRD for ; Tue, 24 Jan 2017 15:53:01 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="BxkrYZgh"; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Received: from mendozajonas.com (mendozajonas.com [188.166.185.233]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3v6wm848bYzDqGw for ; Tue, 24 Jan 2017 15:52:56 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="BxkrYZgh"; dkim-atps=neutral Received: from skellige.ozlabs.ibm.com (unknown [122.99.82.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: sam@mendozajonas.com) by mendozajonas.com (Postfix) with ESMTPSA id 85C35140059; Tue, 24 Jan 2017 12:52:53 +0800 (SGT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mendozajonas.com; s=mail; t=1485233574; bh=55ThRoXqPAnmpm8q4VEo1kZ+tJ5/bEe3qLekffbUIi4=; h=From:To:Cc:Subject:Date:From; b=BxkrYZghRbBZpKXQjPXbjpd1WEAf1lb4rALgFR/Z71aUATU45VRs3oJUJewSNTbi6 dI9b1edeq/b9A81pTC6VBGZT9lilyC4/Ji1rMHB9Zz+WzMGdqdaGmFgZuAVM6N/XG/ m4bBL4fZlhcM53ynXPi6CuGRxokqp0pUqaZ8GJrE= From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [PATCH 1/2] discover/device-handler: Cancel pending boot on reinit Date: Tue, 24 Jan 2017 15:52:47 +1100 Message-Id: <20170124045248.23804-1-sam@mendozajonas.com> X-Mailer: git-send-email 2.11.0 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" When a reinit is requested device_handler_cancel_default() is called, however as the name suggests this only cancels the boot task if it is the result of a default boot option. We also want to cancel a boot task if it was executed manually because it may have outstanding asynchronous tranfers running, so explicitly cancel it during reinit. Signed-off-by: Samuel Mendoza-Jonas --- discover/device-handler.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/discover/device-handler.c b/discover/device-handler.c index 48bfa0e..a3e5bdb 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -351,6 +351,12 @@ void device_handler_reinit(struct device_handler *handler) unsigned int i; device_handler_cancel_default(handler); + /* Cancel any pending non-default boot */ + if (handler->pending_boot) { + boot_cancel(handler->pending_boot); + handler->pending_boot = NULL; + handler->pending_boot_is_default = false; + } /* free unresolved boot options */ list_for_each_entry_safe(&handler->unresolved_boot_options,