From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683207833; x=1685799833; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6BsisgSlocK9midWVxor9aaTbnZ78KuwOyT9JofVm7k=; b=WMSbmsyRSPDnWwFnx5PomEqwUm5t8CTsQ/SZuCqAm18DrOcEATwKcHhu0xvScgY8ZA oD6EkTWY1ExO9/aPboMDvuuu9JdT2rBqQ5pd1HyLvi/q5T+Xc4PIllWfuIkPJraDIes4 YatMId4JHzB7rnqjPofbqbybYAf4MSbTfEcVhx87eq0RAtJXz67XMZRSs8KPNhBUp7Cx brH2B0f/DNUd/+KytZHQqyMLN9pKED1E+FTOVu9djdemR9XhOyRp+8D0/re9gK15lTB1 hEbjb+NtBg41sGawWfO7JuocQJaArZ/SRN94j+199bdFXNZINjhlfxtMzHekSdFu9ur6 iCnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683207833; x=1685799833; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6BsisgSlocK9midWVxor9aaTbnZ78KuwOyT9JofVm7k=; b=ZuJPOK6ecHWj7f4vNIt/kP4zG/W5adSjSOZ9idswWnpUI5DCOkm2qV2AnGLA3CRj6L k+meL+fLn4yNeqG6QieeUwGTZtNqj9qe13A0Qs4tNHLPi/Zu3MW/YmsX5qGMxG0eTi+H yXiYfSUSVD4MB+RBCWiOwV3ura34SBJAGOJf355jvqEM0cFXrgUm+CsenGKGGyPR6gMs KBbO6tv1y7UzX+jNf/Ic9ECtS4HOfI8j5w7pL/TlnI/vSJ8qF2LaGOGinCm3PyFJUXNJ bqyi1XlDWjO1Fig/8jlugd219htBQlMQsI+Aj3aHTwMNXj/O3fmkj32kxMCt7Cb35lFt ExvQ== X-Gm-Message-State: AC+VfDxuSeNGisL0yfLUzrMaCtQ0BCeEhthPm6GuAH8c4szyRa0NRLqX 05p5u+LmfUMR1QqGcY2kd7q8hQTw4vQ= X-Google-Smtp-Source: ACHHUZ5JlZnONtE/cJl35A97BvpVGXqNMRSrU1P1AZeBFLn59PivdC3dwcFB/FPh9yWy73EbgExCwg== X-Received: by 2002:a5d:53d0:0:b0:306:320f:7bd0 with SMTP id a16-20020a5d53d0000000b00306320f7bd0mr2464693wrw.19.1683207833513; Thu, 04 May 2023 06:43:53 -0700 (PDT) From: Alexey Gladkov To: make-initrd@lists.altlinux.org Date: Thu, 4 May 2023 15:42:52 +0200 Message-Id: <7506452afdab642fdee8d31ce6491161d9a5cbcb.1683200226.git.gladkov.alexey@gmail.com> X-Mailer: git-send-email 2.33.7 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [make-initrd] [PATCH 3/3] feature/kickstart: Reset rootdelay timer after kickstart X-BeenThere: make-initrd@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: make-initrd@lists.altlinux.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2023 13:43:59 -0000 Archived-At: List-Archive: If the rootdelay timer has started counting down, then after poll is unpaused, a timeout may occur. This is because the rootdelay remembers the time and if the kickstart took a long time it will timeout the next time the rootdelay is checked. To avoid this we reset the timer before we unpause poll. Signed-off-by: Alexey Gladkov --- data/bin/initrd-sh-functions | 8 ++++++++ data/lib/uevent/handlers/poll/400-rootdelay | 13 ++++++------- features/kickstart/data/etc/rc.d/init.d/kickstart | 3 +++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/data/bin/initrd-sh-functions b/data/bin/initrd-sh-functions index 1f2c1a8d..f33885ba 100644 --- a/data/bin/initrd-sh-functions +++ b/data/bin/initrd-sh-functions @@ -106,6 +106,7 @@ readline() } _rootdelay_pause=/.initrd/rootdelay/pause +_rootdelay_timestamp=/.initrd/rootdelay/deadline rootdelay_pause() { @@ -122,6 +123,13 @@ rootdelay_paused() [ -d "$_rootdelay_pause" ] } +rootdelay_reset_timer() +{ + local now + now="$(date +'%s')" + echo $(( $now + $ROOTDELAY )) > "$_rootdelay_timestamp" +} + initrd_features=/.initrd/features has_feature() diff --git a/data/lib/uevent/handlers/poll/400-rootdelay b/data/lib/uevent/handlers/poll/400-rootdelay index e7089956..cac86622 100755 --- a/data/lib/uevent/handlers/poll/400-rootdelay +++ b/data/lib/uevent/handlers/poll/400-rootdelay @@ -23,31 +23,30 @@ fi first_iter= now="$(date +'%s')" -timestamp="/.initrd/rootdelay/deadline" consmsg="/.initrd/rootdelay/message" -if [ ! -f "$timestamp" ]; then +if [ ! -f "$_rootdelay_timestamp" ]; then first_iter=1 deadline=$(( $now + $ROOTDELAY )) - mkdir -p -- "${timestamp%/*}" - echo $deadline > "$timestamp" + mkdir -p -- "${_rootdelay_timestamp%/*}" + echo $deadline > "$_rootdelay_timestamp" else - read -r deadline < "$timestamp" + read -r deadline < "$_rootdelay_timestamp" fi deadline="${deadline:-$now}" delay=$(( $deadline - $now )) if rootdelay_paused; then - echo $(( $now + $delay )) > "$timestamp" + echo $(( $now + $delay )) > "$_rootdelay_timestamp" exit 0 fi if [ "$delay" -le 0 ]; then if ! resume_checked; then set_resume_checked - echo $(( $now + $ROOTDELAY )) > "$timestamp" + echo $(( $now + $ROOTDELAY )) > "$_rootdelay_timestamp" exit 0 fi diff --git a/features/kickstart/data/etc/rc.d/init.d/kickstart b/features/kickstart/data/etc/rc.d/init.d/kickstart index e36b9470..ef01bcd6 100755 --- a/features/kickstart/data/etc/rc.d/init.d/kickstart +++ b/features/kickstart/data/etc/rc.d/init.d/kickstart @@ -23,11 +23,14 @@ if [ -s "$KSFILE" ]; then . uevent-sh-functions + . initrd-sh-functions mkdir -p -- "$uevent_confdb/queue/pause/poll" kickstart -v "$KSFILE" + rootdelay_reset_timer + rmdir -- "$uevent_confdb/queue/pause/poll" rmdir -- "$uevent_confdb/queue/pause/udev" rmdir -- "$uevent_confdb/queue/pause/md-raid-member" -- 2.33.7