From owner-freebsd-current@FreeBSD.ORG Tue May 28 15:15:53 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0CF18D90 for ; Tue, 28 May 2013 15:15:53 +0000 (UTC) (envelope-from lars@netapp.com) Received: from mx12.netapp.com (mx12.netapp.com [216.240.18.77]) by mx1.freebsd.org (Postfix) with ESMTP id E94CA1B3 for ; Tue, 28 May 2013 15:15:52 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.87,758,1363158000"; d="scan'208";a="58768637" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx12-out.netapp.com with ESMTP; 28 May 2013 08:15:46 -0700 Received: from vmwexceht01-prd.hq.netapp.com (vmwexceht01-prd.hq.netapp.com [10.106.76.239]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id r4SFFkKZ023778; Tue, 28 May 2013 08:15:46 -0700 (PDT) Received: from SACEXCMBX01-PRD.hq.netapp.com ([169.254.2.208]) by vmwexceht01-prd.hq.netapp.com ([10.106.76.239]) with mapi id 14.03.0123.003; Tue, 28 May 2013 08:13:02 -0700 From: "Eggert, Lars" To: Rick Macklem Subject: Re: mounting root from NFS via ROOTDEVNAME Thread-Topic: mounting root from NFS via ROOTDEVNAME Thread-Index: AQHN/WoQ3bLz4fhIpUOOqbDPPwYM3JhhN1MAgADtYYCAAMxdgIAA5iiAgABChICAt8x3gA== Date: Tue, 28 May 2013 15:13:02 +0000 Message-ID: <375AA8A5-E385-4528-A460-D4B8FCB9497B@netapp.com> References: <1435656219.2547176.1359645941027.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <1435656219.2547176.1359645941027.JavaMail.root@erie.cs.uoguelph.ca> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.106.53.51] Content-Type: text/plain; charset="us-ascii" Content-ID: <14DA5930BE4AAC4E88CBEFBC3589C8B0@hq.netapp.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: Craig Rodrigues , "" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 May 2013 15:15:53 -0000 Hi, to conclude this thread, the patch below allows one to specify an nfs rootf= s via the ROOTDEVNAME kernel option, which will be mounted when BOOTP does = not return a root-path option. Lars diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c index 2c57a91..972fb12 100644 --- a/sys/nfs/bootp_subr.c +++ b/sys/nfs/bootp_subr.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); =20 #include "opt_bootp.h" #include "opt_nfs.h" +#include "opt_rootdevname.h" =20 #include #include @@ -870,8 +871,20 @@ bootpc_call(struct bootpc_globalcontext *gctx, struct = thread *td) rtimo =3D time_second + BOOTP_SETTLE_DELAY; printf(" (got root path)"); - } else + } else { printf(" (no root path)"); +#ifdef ROOTDEVNAME + /* + * If we'll mount rootfs from + * ROOTDEVNAME, we can accept + * offers without root paths. + */ + gotrootpath =3D 1; + rtimo =3D time_second + + BOOTP_SETTLE_DELAY; + printf(" (ROOTDEVNAME)"); +#endif + } printf("\n"); } } /* while secs */ @@ -1440,6 +1453,16 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struc= t bootpc_ifcontext *ifctx, =20 p =3D bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen, TAG_ROOT); +#ifdef ROOTDEVNAME + /* + * If there was no root path in BOOTP, use the one in ROOTDEVNAME. + */ + if (p =3D=3D NULL) { + p =3D strdup(ROOTDEVNAME, M_TEMP); + if (strcmp(strsep(&p, ":"), "nfs") !=3D 0) + panic("ROOTDEVNAME is not an NFS mount point"); + } +#endif if (p !=3D NULL) { if (gctx->setrootfs !=3D NULL) { printf("rootfs %s (ignored) ", p);