From patchwork Mon Aug 27 01:50:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 962314 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41zFGn1q1Lz9ryn for ; Mon, 27 Aug 2018 11:51:13 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="P3cWFvJW"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="rCk5AMJP"; 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 41zFGn0H1bzDrVM for ; Mon, 27 Aug 2018 11:51:13 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="P3cWFvJW"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="rCk5AMJP"; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mendozajonas.com (client-ip=66.111.4.25; helo=out1-smtp.messagingengine.com; envelope-from=sam@mendozajonas.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="P3cWFvJW"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="rCk5AMJP"; dkim-atps=neutral Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41zFGb1tZ4zDr5Y for ; Mon, 27 Aug 2018 11:51:02 +1000 (AEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 66EF32156E; Sun, 26 Aug 2018 21:50:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 26 Aug 2018 21:50:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= mendozajonas.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=3esqlFcxIgp+BKPQF CQ/7SsnJm0GMptHb9rexUzOy0A=; b=P3cWFvJWbmzR47WdiFoQ15DJK8UPR5dPF 7q8vN2GPDW3QjXQjpyytJ5GwQBNI3v4PIHEBUUywB0aIF+zy2zhUddzL/0eBc6GF r9Qnda+cvjp3F0SLvYcnPUPLbh4x4vUbk61VjYV6p8Illu2xM8lB1sN2yA3jByvq vTGUiMnIRw5dUpKuvHAj5thDVpb4FmehkS1pgBuFHvecXaazSfHvea/fN+ycJqHo UgZ5bxEzOkcB1nhFPHioK1P2bVtoedRhyriTJNPCXQ0hXueMp+AAq8ogBu5CXjNx MqCoF5Halw7pEnFbCi4AtVL71qAHVGL6cSvpmPq4hNlJH3rXo9mNA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=3esqlFcxIgp+BKPQF CQ/7SsnJm0GMptHb9rexUzOy0A=; b=rCk5AMJPYQCzfIudaTaIzE/UM63M13072 HxrtmT/TKG8/m5ibC4CFkjk/fOB4IPqr//VbxTVcvb+0Ch7kFHI7JbtH+CXOIczX /dT/+yc0PlPdc5CF3Oxw9ZppXpMMlZLqyPL++kPT9PT64/6fF4mO7/9ENEZyWXCF KzZQNacW1SJ6QGnQnGPKID8UygW21mJ2nivon+MCLp8xuEwNb0i6cYodlmsV0Oaj +9rmaLCa/ziVd9g5wBTMrxNGCbgRIOxBD0c5hq8CFyvAcpSgd4eXQHmz2pXPs4aA a3TJZ4nZRvuVlvTHbR2H40YW9SOig+Uhu3ZWN/PLOm+jvb5ZjtD2A== X-ME-Proxy: X-ME-Sender: Received: from v4.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 6B301E4693; Sun, 26 Aug 2018 21:50:55 -0400 (EDT) From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [PATCH] discover/device-handler: Restore autoboot setting on requery Date: Mon, 27 Aug 2018 11:50:47 +1000 Message-Id: <20180827015047.24676-1-sam@mendozajonas.com> X-Mailer: git-send-email 2.18.0 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.27 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 device requery is triggered we cancel any default boot option on the device. This also disables autoboot which we don't want; any boot options found after the requery will not be able to autoboot. To avoid this restore the existing autoboot setting after checking for default options. This prevents a particular corner case where a default boot option has been selected for boot but one of its boot files has stalled or is taking more time to download than the requery timeout and the requery accidentally cancels autoboot preventing Petitboot from trying to boot again. Signed-off-by: Samuel Mendoza-Jonas --- discover/device-handler.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/discover/device-handler.c b/discover/device-handler.c index cf379e78..34437d66 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -1278,6 +1278,7 @@ static int device_handler_requery_timeout_fn(void *data) struct requery_data *rqd = data; struct device_handler *handler; struct discover_device *device; + bool autoboot; handler = rqd->handler; device = rqd->device; @@ -1300,6 +1301,11 @@ static int device_handler_requery_timeout_fn(void *data) talloc_free(opt); } + /* Track whether autoboot was enabled, if we cancel a default option + * it will be switched off. + */ + autoboot = handler->autoboot_enabled; + list_for_each_entry_safe(&device->boot_options, opt, tmp, list) { if (opt == handler->default_boot_option) { pb_log("Default option %s cancelled since device is being requeried", @@ -1310,6 +1316,8 @@ static int device_handler_requery_timeout_fn(void *data) talloc_free(opt); } + handler->autoboot_enabled = autoboot; + discover_server_notify_device_remove(handler->server, device->device); device->notified = false;