From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id n5kxJryRs181GQAA0tVLHw (envelope-from ) for ; Tue, 17 Nov 2020 09:02:52 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id YKi8IbyRs1+YegAA1q6Kng (envelope-from ) for ; Tue, 17 Nov 2020 09:02:52 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3C3709402B0 for ; Tue, 17 Nov 2020 09:02:52 +0000 (UTC) Received: from localhost ([::1]:52452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kewt1-0004QE-29 for larch@yhetil.org; Tue, 17 Nov 2020 04:02:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kewso-0004Ny-9T for guix-devel@gnu.org; Tue, 17 Nov 2020 04:02:38 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50749) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kewsn-0000ak-BU; Tue, 17 Nov 2020 04:02:37 -0500 Received: from [2a01:e0a:19b:d9a0:3036:7cf3:6a95:6495] (port=53500 helo=cervin) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kewsm-0006Gq-Eo; Tue, 17 Nov 2020 04:02:36 -0500 From: Mathieu Othacehe To: "pelzflorian (Florian Pelz)" Subject: Re: GNU Guix 1.2.0rc1 available for testing! References: <87d00hchij.fsf@gnu.org> <20201115191618.zuvkz65o3kcahfoz@pelzflorian.localdomain> <874klqb82u.fsf@gnu.org> <20201115231643.7mslq2sjzliv4nfd@pelzflorian.localdomain> <87v9e5ll7a.fsf@gnu.org> <20201116114708.lpq2ildggzusbqqu@pelzflorian.localdomain> Date: Tue, 17 Nov 2020 10:02:33 +0100 In-Reply-To: <20201116114708.lpq2ildggzusbqqu@pelzflorian.localdomain> (pelzflorian@pelzflorian.de's message of "Mon, 16 Nov 2020 12:47:53 +0100") Message-ID: <871rgsz786.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Spam-Score: -1.51 X-TUID: iV3CA86X+BKM --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello Florian, > Thank you for the quick patch! Clearly you have been spot-on. > =E2=80=9CPartition formatting is in progress, please wait=E2=80=9D is dis= played > considerably longer but eventually succeeds. I tried 3 times > successfully with your patch. I tried again without your patch and it > failed. I tried once more with your patch and formatting succeeded > again. That's good news! Here's a more complete patch that I intend to push on the 1.2.0 branch. It logs the time spent waiting for disk synchronization. It would be great if you could test it one more time, so that we know if 4 seconds is enough or if we should use an even higher delay. Thanks again, Mathieu --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-installer-Fix-device-synchronization.patch >From f3d41cff6704ad748d51e4dd548c045034656b66 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Tue, 17 Nov 2020 09:50:01 +0100 Subject: [PATCH] installer: Fix device synchronization. Reported by Florian Pelz: https://lists.gnu.org/archive/html/guix-devel/2020-11/msg00326.html. * gnu/installer/utils.scm (call-with-time): New procedure, (let/time): new macro. * gnu/installer/parted.scm (with-delay-device-in-use?): Increase the retry count to 16. (non-install-devices): Remove the call to with-delay-device-in-use? as it doesn't return the expected result, and would block much longer now. (free-parted): Log the time required to sync each device. --- gnu/installer/parted.scm | 27 ++++++++++++++------------- gnu/installer/utils.scm | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm index f2352c5779..3ad1721795 100644 --- a/gnu/installer/parted.scm +++ b/gnu/installer/parted.scm @@ -41,6 +41,7 @@ #:use-module (ice-9 regex) #:use-module (rnrs io ports) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-19) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) @@ -318,7 +319,7 @@ PARTED-OBJECT field equals PARTITION, return #f if not found." fail. See rereadpt function in wipefs.c of util-linux for an explanation." ;; Kernel always return EINVAL for BLKRRPART on loopdevices. (and (not (string-match "/dev/loop*" file-name)) - (let loop ((try 4)) + (let loop ((try 16)) (usleep 250000) (let ((in-use? (device-in-use? file-name))) (if (and in-use? (> try 0)) @@ -339,15 +340,12 @@ fail. See rereadpt function in wipefs.c of util-linux for an explanation." (define (non-install-devices) "Return all the available devices, except the busy one, allegedly the install device. DEVICE-IS-BUSY? is a parted call, checking if the device is -mounted. The install image uses an overlayfs so the install device does not -appear as mounted and won't be considered as busy. So use also DEVICE-IN-USE? -from (guix build syscalls) module, who will try to re-read the device's -partition table to determine whether or not it is already used (like sfdisk -from util-linux)." +mounted." + ;; FIXME: The install image uses an overlayfs so the install device does not + ;; appear as mounted and won't be considered as busy. (remove (lambda (device) (let ((file-name (device-path device))) - (or (device-is-busy? device) - (with-delay-device-in-use? file-name)))) + (device-is-busy? device))) (devices))) @@ -1368,9 +1366,12 @@ the devices not to be used before returning." (let ((device-file-names (map device-path devices))) (for-each force-device-sync devices) (for-each (lambda (file-name) - (let ((in-use? (with-delay-device-in-use? file-name))) - (and in-use? - (error - (format #f (G_ "Device ~a is still in use.") - file-name))))) + (let/time ((time in-use? + (with-delay-device-in-use? file-name))) + (if in-use? + (error + (format #f (G_ "Device ~a is still in use.") + file-name)) + (syslog "Syncing ~a took ~a seconds.~%" + file-name (time-second time))))) device-file-names))) diff --git a/gnu/installer/utils.scm b/gnu/installer/utils.scm index 5f8fe8ca01..a7fa66a199 100644 --- a/gnu/installer/utils.scm +++ b/gnu/installer/utils.scm @@ -22,6 +22,7 @@ #:use-module (guix build utils) #:use-module (guix i18n) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-19) #:use-module (srfi srfi-34) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) @@ -36,6 +37,8 @@ syslog-port syslog + call-with-time + let/time with-server-socket current-server-socket @@ -117,6 +120,17 @@ COMMAND exited successfully, #f otherwise." ;;; Logging. ;;; +(define (call-with-time thunk kont) + "Call THUNK and pass KONT the elapsed time followed by THUNK's return +values." + (let* ((start (current-time time-monotonic)) + (result (call-with-values thunk list)) + (end (current-time time-monotonic))) + (apply kont (time-difference end start) result))) + +(define-syntax-rule (let/time ((time result exp)) body ...) + (call-with-time (lambda () exp) (lambda (time result) body ...))) + (define (open-syslog-port) "Return an open port (a socket) to /dev/log or #f if that wasn't possible." (let ((sock (socket AF_UNIX SOCK_DGRAM 0))) -- 2.29.2 --=-=-=--