Maxim Cournoyer <maxim.cournoyer@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Maxim Cournoyer <maxim.cournoyer@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 39770) by debbugs.gnu.org; 24 Feb 2020 21:21:31 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 24 16:21:30 2020 Received: from localhost ([127.0.0.1]:54200 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1j6LAQ-0005iT-He for submit <at> debbugs.gnu.org; Mon, 24 Feb 2020 16:21:30 -0500 Received: from mail-qt1-f170.google.com ([209.85.160.170]:42096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1j6LAO-0005iE-F5 for 39770 <at> debbugs.gnu.org; Mon, 24 Feb 2020 16:21:28 -0500 Received: by mail-qt1-f170.google.com with SMTP id r5so7584579qtt.9 for <39770 <at> debbugs.gnu.org>; Mon, 24 Feb 2020 13:21:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=qAr0d4S3m4EV1ZIPxF1qx7joUsjueaubKAlONnOmvXY=; b=Gd7q0fRfrn063q34vJQkHyWPcyZD0/qW+2kAuKUZ9ysxQ1aJ9/IA9cLbloB0dxZXvL GXt3EYcpn+XNeAXMYNkd2zALTiY9u7bRFRrWMSMzRSZJu0aXW0gJt4KQ3xOrfrZLB2nn AImQ6KBHrUad4nN2zbDaligZ1RHd5LmzjFO7h5/X/1Mens6L250e0k2Prl6n2JkODME1 EYXFXMelfUta+bpQ2sPf//rqBjHHvlXVF+r6NkAfqaowfAz0505SWRaPbHl9/D84iB19 g2GxG+PQ7UmITBIlm9sF+WHfAaxjKCY+PoORXui9De/gMV4jtWngbBX7oOzLPZDTgOIq PLgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=qAr0d4S3m4EV1ZIPxF1qx7joUsjueaubKAlONnOmvXY=; b=teVqtl7mlE1j9TBXMB2524smZnNXZI1IJrm70onQNZVIPJJRaw4ra1OrOj+66uIul1 3Eu0wMCjbFmCGN3D9Z8H6WAA1eavguf3bVArNxzSx8NFKI05vvXH0moDuWH34HXChgF4 10GMemkQ6J1YBXI3WrcpSXtwiJhhPfSeTSNgdwkwxAKJOaygibAavqQtIUN7J4ngvdpE Hmd7h106xUnB9o7gSsna+OFMvNHkpprFM0fKRLV2x7nmfercZ0k99XE2u/MIeQ1V6ymT hE5Ii/D6YjBvIHXn6AMkkYsvqwoQDZUmt/g5pdMw8szkFafd+dmOkWKXMJeyUId5KXJ7 E+wA== X-Gm-Message-State: APjAAAUu4KBqpzZWxHs+e69G3EejtQUIN3S93aJ6TO8WSvnTxy8hCjPB J1EMfj4Lr1kX8YraiCC7m9MZl057 X-Google-Smtp-Source: APXvYqxLba5dXw4qzSphTRn/a+O6X+gsOBQTLshzL/vdVe0/DnalFrkRrQJ1LmdWSYk81mwWokXtKg== X-Received: by 2002:ac8:2bf9:: with SMTP id n54mr48954200qtn.280.1582579282779; Mon, 24 Feb 2020 13:21:22 -0800 (PST) Received: from raisin ([2607:fad8:4:6:235e:8579:8464:aacc]) by smtp.gmail.com with ESMTPSA id c45sm6649714qtd.43.2020.02.24.13.21.21 for <39770 <at> debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 13:21:22 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> To: 39770 <at> debbugs.gnu.org Subject: Re: bug#39770: mount-file-system fails to mount NFS file system References: <875zfvixlq.fsf@HIDDEN> Date: Mon, 24 Feb 2020 16:21:21 -0500 In-Reply-To: <875zfvixlq.fsf@HIDDEN> (maxim cournoyer's message of "Mon, 24 Feb 2020 14:39:13 -0500") Message-ID: <871rqjisvi.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39770 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hi, maxim.cournoyer@HIDDEN writes: [...] > It seems we're missing either a "vers" (doubtful) or more likely the > "clientaddr" option. It turns out that the "vers" (or more specifically, "nfsvers") option was mandatory to resolve this error. What "mount.nfs" from nfs-utils seems to do is start with "4.2", then retry upon errors lesser versions. The attached patch adds the required "nfsvers=4.2" option by default, or honors a user specified one. No retry is done. Note that it currently uses file system options represented as an alist, but this is likely to change as the code review on "allow booting from a Btrfs subvolume" progresses (the current patch is based atop of <https://bugs.gnu.org/37305>). Maxim --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-build-file-systems-Specify-a-nfsvers-option-by-defau.patch From 6cbae0746dbeb736dc8c037183038eca2f7867fd Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@HIDDEN> Date: Mon, 24 Feb 2020 16:09:10 -0500 Subject: [PATCH] build: file-systems: Specify a "nfsvers" option by default for NFS. Without it, the mount system call fails with an ECONNREFUSED (Connection refused) error. * gnu/build/file-systems.scm (nfs-source->ip-address): Add procedure, with code moved from... (mount-file-system): ...the inner `mount-nfs' procedure, now removed. The NFS specific required options default values are now computed and added to the regular options. Honor any user given "addr", "nfsvers" or "vers" option." Remove the call to `mount-nfs', no longer needed. --- gnu/build/file-systems.scm | 59 +++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm index 76c143654d..fdeb12e825 100644 --- a/gnu/build/file-systems.scm +++ b/gnu/build/file-systems.scm @@ -640,36 +640,45 @@ corresponds to the symbols listed in FLAGS." (() 0)))) +(define (nfs-source->ip-address source) + "Return the IP address from the source component of a network file-system." + (let* ((idx (string-rindex source #\:)) + (host-part (string-take source idx)) + ;; Strip [] from around host if present + (host (match (string-split host-part (string->char-set "[]")) + (("" h "") h) + ((h) h))) + (aa (match (getaddrinfo host "nfs") ((x . _) x))) + (sa (addrinfo:addr aa))) + (inet-ntop (sockaddr:fam sa) + (sockaddr:addr sa)))) + (define* (mount-file-system fs #:key (root "/root")) "Mount the file system described by FS, a <file-system> object, under ROOT." - (define (mount-nfs source mount-point type flags options) - (let* ((idx (string-rindex source #\:)) - (host-part (string-take source idx)) - ;; Strip [] from around host if present - (host (match (string-split host-part (string->char-set "[]")) - (("" h "") h) - ((h) h))) - (aa (match (getaddrinfo host "nfs") ((x . _) x))) - (sa (addrinfo:addr aa)) - (inet-addr (inet-ntop (sockaddr:fam sa) - (sockaddr:addr sa)))) - - ;; Mounting an NFS file system requires passing the address - ;; of the server in the addr= option - (mount source mount-point type flags - (string-append "addr=" - inet-addr - (if options - (string-append "," options) - ""))))) (let* ((type (file-system-type fs)) (nfs? (string-prefix? "nfs" type)) + (source (canonicalize-device-spec (file-system-device fs))) (fs-options (file-system-options fs)) - (options (if (null? fs-options) + (fs-options* + (if nfs? + ;; Do not override user specified "addr", "nfsvers" or "vers", + ;; but provide default values as otherwise mount fails to + ;; connect. + `(,@fs-options + ,@(if (member "addr" fs-options) + '() + (list (format #f "addr=~a" + (nfs-source->ip-address source)))) + ,@(if (or (assoc-ref fs-options "nfsvers") + (assoc-ref fs-options "vers")) + '() + (list "nfsvers=4.2"))) + fs-options)) + (options (if (null? fs-options*) #f - (file-system-options->string fs-options))) - (source (canonicalize-device-spec (file-system-device fs))) + (file-system-options->string fs-options*))) + (mount-point (string-append root "/" (file-system-mount-point fs))) (flags (mount-flags->bit-mask (file-system-flags fs)))) @@ -685,9 +694,7 @@ corresponds to the symbols listed in FLAGS." (call-with-output-file mount-point (const #t))) (mkdir-p mount-point)) - (if nfs? - (mount-nfs source mount-point type flags options) - (mount source mount-point type flags options)) + (mount source mount-point type flags options) ;; For read-only bind mounts, an extra remount is needed, as per ;; <http://lwn.net/Articles/281157/>, which still applies to Linux 4.0. -- 2.25.0 --=-=-=--
bug-guix@HIDDEN
:bug#39770
; Package guix
.
Full text available.Received: (at submit) by debbugs.gnu.org; 24 Feb 2020 19:39:20 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 24 14:39:20 2020 Received: from localhost ([127.0.0.1]:54133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1j6JZX-0001Ah-UK for submit <at> debbugs.gnu.org; Mon, 24 Feb 2020 14:39:20 -0500 Received: from lists.gnu.org ([209.51.188.17]:52886) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>) id 1j6JZW-0001AZ-77 for submit <at> debbugs.gnu.org; Mon, 24 Feb 2020 14:39:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38858) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>) id 1j6JZV-0006tz-09 for bug-guix@HIDDEN; Mon, 24 Feb 2020 14:39:18 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <maxim.cournoyer@HIDDEN>) id 1j6JZT-0002wy-Up for bug-guix@HIDDEN; Mon, 24 Feb 2020 14:39:16 -0500 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:43961) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <maxim.cournoyer@HIDDEN>) id 1j6JZT-0002wV-QW for bug-guix@HIDDEN; Mon, 24 Feb 2020 14:39:15 -0500 Received: by mail-qk1-x729.google.com with SMTP id p7so9733659qkh.10 for <bug-guix@HIDDEN>; Mon, 24 Feb 2020 11:39:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=Dlq6HdwCVPgs4XbY+CB+sRoXw8xf2zC5Bjg/QXt4o84=; b=npWRFJhGlhTwS2r6CfLCE7bDjgNxgmaBFrTYX0iM2pk2EUch99s3T1aPpxL5xmekG5 Rk6xsFw6zqXpqF5tieEbn+H/egBh26Exe2iXissKVJP49/TgO1Sx5iRTmxp6Scf00uHK C+kC3lYiLsSBVKhp1Jpt+NkYB2Yr+gOtfc2VRpsvtkSIe263CX/2NamMz0CKF7c/8Hvz jFegB1WSZjfRFjC1Eaaizx15VZO2+eu/aZeaCCW0kl2Bb51XHbQl/JUqUpgVwI5z07Lb nJakqa4fnkzRB5SJusFNuJyjuzMQY80/M9i+TWSay7duQu0/K7lH5cjmsc8TWPa92JA8 p+vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=Dlq6HdwCVPgs4XbY+CB+sRoXw8xf2zC5Bjg/QXt4o84=; b=tsUVkLcyZ+eYVkx6gDsEgVc4Dx1e5kTIb1+gAxNzJml9FEbM9XqPyp6v0cc4/cB41/ BvDBCoZ7dGbo5UCj7bm2m6dn/0C5UGGxPsZne2BHUEe78UXjb++49fddwHyTpevUQToj k4DOUARRE/O2A/JpS82gxwM1eNJmI6/MHZ+B/S8YxYftCNi/ByKVFi0PVWL1MiU9ThiI uxPjPor6FupCt3B5MGUdcLTdyfnykv5Mmk/s35ETLMiCFjcft5SWyrynk7Hz4jVwbF27 7aa06lFx2yMRfFK2Bgj6YMCYX9mMfYGnPtRDEpjorB2hsxk2WP8o3fi+gSHWEpBL+r47 QU2g== X-Gm-Message-State: APjAAAVJ0QDgl/KCHdHcgQ4NrUfb2+o4SXHEudNcFBxvwIciwwPPPGXt oX6AiAPFrPlkRNW2s+PpSNtvcCI8 X-Google-Smtp-Source: APXvYqyj1yHH4VFSRojo+9OhlMo5cJQ077L7CQvnThYapoQwzyZIB8zptLoUfjza+gurCtEmDvPjyA== X-Received: by 2002:a05:620a:1464:: with SMTP id j4mr4330393qkl.310.1582573154936; Mon, 24 Feb 2020 11:39:14 -0800 (PST) Received: from raisin ([2607:fad8:4:6:235e:8579:8464:aacc]) by smtp.gmail.com with ESMTPSA id t4sm6340404qkm.82.2020.02.24.11.39.14 for <bug-guix@HIDDEN> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 11:39:14 -0800 (PST) From: maxim.cournoyer@HIDDEN X-Google-Original-From: mcournoyer@HIDDEN To: bug-guix <bug-guix@HIDDEN> Subject: mount-file-system fails to mount NFS file system Date: Mon, 24 Feb 2020 14:39:13 -0500 Message-ID: <875zfvixlq.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::729 X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.7 (/) The mount-file-system call used in our init RAM disk (see: (gnu build file-systems)) doesn't produce the correct system call as can be demontstrated by the following C program: --8<---------------cut here---------------start------------->8--- #include <errno.h> #include <stdio.h> #include <string.h> #include <sys/mount.h> /* int mount(const char *source, const char *target, */ /* const char *filesystemtype, unsigned long mountflags, */ /* const void *data); */ int main() { //char *src = "192.168.51.34:/mnt/scratch/yocto-sstate"; char *src = "192.168.51.34:/mnt/scratch/yocto-sstate"; char *target = "/mnt/scratch/yocto-sstate"; char *type = "nfs"; unsigned long mountflags = 0; char *data = "addr=192.168.51.34"; //file system specific options int ret = 0; ret = mount(src, target, type, mountflags, data); if (ret == -1); { int errsv = errno; printf("mount() failed with error: %s\n", strerror(errsv)); } } --8<---------------cut here---------------end--------------->8--- Running the program with strace, we can see that it failed with a connection refused error: --8<---------------cut here---------------start------------->8--- /* mount("192.168.51.34:/mnt/scratch/yocto-sstate", "/mnt/scratch/yocto-sstate", "nfs", 0, "addr=192.168.51.34") = -1 ECONNREFUSED (Connection refused) */ --8<---------------cut here---------------end--------------->8--- When having nfs-utils installed and tracing mount.nfs with: --8<---------------cut here---------------start------------->8--- strace -f -s320 mount j1-slave1.sfl.team:/mnt/scratch/yocto-dldir /mnt/scratch/yocto-dldir -t nfs --8<---------------cut here---------------end--------------->8--- We can see that the working invocation reads as: --8<---------------cut here---------------start------------->8--- mount("j1-slave1.sfl.team:/mnt/scratch/yocto-dldir", "/mnt/scratch/yocto-dldir", "nfs", 0, "vers=4.2,addr=192.168.51.34,clientaddr=192.168.49.249") --8<---------------cut here---------------end--------------->8--- It seems we're missing either a "vers" (doubtful) or more likely the "clientaddr" option. Maxim
maxim.cournoyer@HIDDEN
:bug-guix@HIDDEN
.
Full text available.bug-guix@HIDDEN
:bug#39770
; Package guix
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.