On Mon, Jan 06, 2020 at 12:39:52AM -0800, Josh Triplett wrote:
> That's an *additional* delay, on top of the sleeps above. The two-second
> sleep in the "exitcode" function seems like the primary culprit.  Note
> that I don't even have lvm2-tools installed.

Ah, yes, sorry, I had missed the sleep in the exitcode function.
Actually it's not needed in e2scrub_all at all; it was there due
copy/paste oversight.

The commit below should address your concern.

Cheers,

                                        - Ted

commit 0b3208958eb63df6cd8b38ee63f3bc4266a683e7
Author: Theodore Ts'o <ty...@mit.edu>
Date:   Mon Jan 6 16:01:23 2020 -0500

    e2scrub, e2scrub_all: don't sleep unnecessarily in exitcode
    
    The two second sleep is only needed in e2scrub, and when there is a
    failure, so that systemd has a chance to gather the log output before
    e2scrub exits.  It's not needed if the script is exiting successfully,
    and it's never needed for e2scrub_all ever.
    
    Addresses-Debian-Bug: #948193
    Signed-off-by: Theodore Ts'o <ty...@mit.edu>

diff --git a/scrub/e2scrub.in b/scrub/e2scrub.in
index f21499b6..30ab7cbd 100644
--- a/scrub/e2scrub.in
+++ b/scrub/e2scrub.in
@@ -66,7 +66,7 @@ exitcode() {
        # for capturing all the log messages if the scrub fails, because the
        # fail service uses the service name to gather log messages for the
        # error report.
-       if [ -n "${SERVICE_MODE}" ]; then
+       if [ -n "${SERVICE_MODE}" -a "${ret}" -ne 0 ]; then
                test "${ret}" -ne 0 && ret=1
                sleep 2
        fi
diff --git a/scrub/e2scrub_all.in b/scrub/e2scrub_all.in
index f0336711..4288b969 100644
--- a/scrub/e2scrub_all.in
+++ b/scrub/e2scrub_all.in
@@ -56,14 +56,8 @@ exitcode() {
        # section 22.2) and hope the admin will scan the log for what
        # actually happened.
 
-       # We have to sleep 2 seconds here because journald uses the pid to
-       # connect our log messages to the systemd service.  This is critical
-       # for capturing all the log messages if the scrub fails, because the
-       # fail service uses the service name to gather log messages for the
-       # error report.
-       if [ -n "${SERVICE_MODE}" ]; then
+       if [ -n "${SERVICE_MODE}" -a "${ret}" -ne 0 ]; then
                test "${ret}" -ne 0 && ret=1
-               sleep 2
        fi
 
        exit "${ret}"

Reply via email to