From: Alexey Gladkov <gladkov.alexey@gmail.com> To: make-initrd@lists.altlinux.org Subject: [make-initrd] [PATCH 3/3] feature/kickstart: Reset rootdelay timer after kickstart Date: Thu, 4 May 2023 15:42:52 +0200 Message-ID: <7506452afdab642fdee8d31ce6491161d9a5cbcb.1683200226.git.gladkov.alexey@gmail.com> (raw) In-Reply-To: <cover.1683200226.git.gladkov.alexey@gmail.com> 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 <gladkov.alexey@gmail.com> --- 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
next prev parent reply other threads:[~2023-05-04 13:42 UTC|newest] Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-04 13:42 [make-initrd] [PATCH 0/3] Reimplement ueventd Alexey Gladkov 2023-05-04 13:42 ` [make-initrd] [PATCH 1/3] " Alexey Gladkov 2023-05-05 3:08 ` Leonid Krivoshein 2023-05-05 17:02 ` Alexey Gladkov 2023-05-05 4:03 ` Leonid Krivoshein 2023-05-05 17:16 ` Alexey Gladkov 2023-05-05 5:21 ` Leonid Krivoshein 2023-05-05 17:24 ` Alexey Gladkov 2023-05-14 20:12 ` Leonid Krivoshein 2023-05-14 20:45 ` Alexey Gladkov 2023-05-14 20:57 ` Leonid Krivoshein 2023-05-15 8:52 ` Alexey Gladkov 2023-05-14 23:08 ` Leonid Krivoshein 2023-05-15 9:05 ` Alexey Gladkov 2023-05-15 0:47 ` Leonid Krivoshein 2023-05-15 9:12 ` Alexey Gladkov 2023-05-15 4:38 ` Leonid Krivoshein 2023-05-15 10:43 ` Alexey Gladkov 2023-05-18 6:39 ` Leonid Krivoshein 2023-05-18 7:05 ` Alexey Gladkov 2023-05-20 9:00 ` Leonid Krivoshein 2023-05-20 13:18 ` Alexey Gladkov 2023-05-20 15:17 ` Vladimir D. Seleznev 2023-05-20 17:23 ` Leonid Krivoshein 2023-05-20 18:51 ` Alexey Gladkov 2023-05-21 8:53 ` [make-initrd] [PATCH] ueventd: Don't use a epoll timeout when it's not needed Alexey Gladkov 2023-05-22 4:46 ` Leonid Krivoshein 2023-05-22 7:54 ` Alexey Gladkov 2023-05-22 9:19 ` Alexey Gladkov 2023-05-22 7:57 ` [make-initrd] [PATCH 1/2] ueventd: Fix memory leak Alexey Gladkov 2023-05-22 7:57 ` [make-initrd] [PATCH 2/2] ueventd: Change interface rd_asprintf_or_die Alexey Gladkov 2023-05-22 9:36 ` [make-initrd] [PATCH v2] " Alexey Gladkov 2023-05-20 16:37 ` [make-initrd] [PATCH 1/3] ueventd: Simplify call of the queue handler Alexey Gladkov 2023-05-20 16:37 ` [make-initrd] [PATCH 2/3] ueventd: Rename fd_list to fd_handler_list Alexey Gladkov 2023-05-20 16:37 ` [make-initrd] [PATCH 3/3] ueventd: Drop obsolete declarations Alexey Gladkov 2023-05-04 13:42 ` [make-initrd] [PATCH 2/3] Replace polld by uevent queue Alexey Gladkov 2023-05-04 13:42 ` Alexey Gladkov [this message] 2023-05-06 19:45 ` [make-initrd] ueventd: Add a prefix to the logging functions to avoid name collisions Alexey Gladkov 2023-05-06 19:45 ` [make-initrd] ueventd: Allow to configure the log destination Alexey Gladkov 2023-05-06 19:45 ` [make-initrd] ueventd: Pass the program name when initializing the logger Alexey Gladkov 2023-05-06 19:45 ` [make-initrd] ueventd: Rewrite logging function to make it more atomic Alexey Gladkov 2023-05-07 12:48 ` [make-initrd] [PATCH 0/3] Reimplement ueventd Alexey Gladkov 2023-05-13 11:50 ` Alexey Gladkov 2023-05-14 20:15 ` Leonid Krivoshein 2023-05-14 20:49 ` Alexey Gladkov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=7506452afdab642fdee8d31ce6491161d9a5cbcb.1683200226.git.gladkov.alexey@gmail.com \ --to=gladkov.alexey@gmail.com \ --cc=make-initrd@lists.altlinux.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Make-initrd development discussion This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/make-initrd/0 make-initrd/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 make-initrd make-initrd/ http://lore.altlinux.org/make-initrd \ make-initrd@lists.altlinux.org make-initrd@lists.altlinux.ru make-initrd@lists.altlinux.com public-inbox-index make-initrd Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.make-initrd AGPL code for this site: git clone https://public-inbox.org/public-inbox.git