From owner-svn-src-head@freebsd.org Tue Apr 11 15:20:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2397AD39C6E; Tue, 11 Apr 2017 15:20:34 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D13C0B70; Tue, 11 Apr 2017 15:20:33 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3BFKXMJ097542; Tue, 11 Apr 2017 15:20:33 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3BFKWAi097541; Tue, 11 Apr 2017 15:20:32 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201704111520.v3BFKWAi097541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 11 Apr 2017 15:20:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316704 - head/sys/boot/efi/loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Apr 2017 15:20:34 -0000 Author: tsoome Date: Tue Apr 11 15:20:32 2017 New Revision: 316704 URL: https://svnweb.freebsd.org/changeset/base/316704 Log: loader.efi: only fetch zfs pool guid for the actual boot device With the zfs probe cleanup, the mistake did slip in the probe code; instead of reading the pool GUID for the actual boot device (partition), we read GUID for first found pool from the boot disk. This will break the case when there are both zfs pool and ufs on the boot disk, and the ufs is used for boot, not zfs. Reviewed by: smh Differential Revision: https://reviews.freebsd.org/D10359 Modified: head/sys/boot/efi/loader/main.c Modified: head/sys/boot/efi/loader/main.c ============================================================================== --- head/sys/boot/efi/loader/main.c Tue Apr 11 13:42:26 2017 (r316703) +++ head/sys/boot/efi/loader/main.c Tue Apr 11 15:20:32 2017 (r316704) @@ -804,38 +804,26 @@ efi_zfs_probe(void) pdinfo_t *hd, *pd = NULL; EFI_GUID imgid = LOADED_IMAGE_PROTOCOL; EFI_LOADED_IMAGE *img; - EFI_HANDLE boot_disk = NULL; char devname[SPECNAMELEN + 1]; - uint64_t *guidp = NULL; BS->HandleProtocol(IH, &imgid, (VOID**)&img); - - /* Find the handle for the boot disk. */ hdi = efiblk_get_pdinfo_list(&efipart_hddev); - STAILQ_FOREACH(hd, hdi, pd_link) { - STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { - if (pd->pd_handle == img->DeviceHandle) - boot_disk = hd->pd_handle; - } - } /* - * We provide non-NULL guid pointer if the disk was used for boot, - * and reset after the first found pool. - * Technically this solution is not very correct, we assume the boot - * pool is the first pool on this disk. + * Find the handle for the boot device. The boot1 did find the + * device with loader binary, now we need to search for the + * same device and if it is part of the zfs pool, we record the + * pool GUID for currdev setup. */ - STAILQ_FOREACH(hd, hdi, pd_link) { - if (hd->pd_handle == boot_disk) - guidp = &pool_guid; - STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { + snprintf(devname, sizeof(devname), "%s%dp%d:", efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit); - (void) zfs_probe_dev(devname, guidp); - if (guidp != NULL && pool_guid != 0) - guidp = NULL; + if (pd->pd_handle == img->DeviceHandle) + (void) zfs_probe_dev(devname, &pool_guid); + else + (void) zfs_probe_dev(devname, NULL); } } }