From nobody Sun Jan 08 16:46:34 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Nqjdk4dbsz2pN3H; Sun, 8 Jan 2023 16:46:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Nqjdk3sRXz4871; Sun, 8 Jan 2023 16:46:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673196394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0zflf/fzpUrdFZ5HnAUQTHExxt0ihih6wncbZA8/45g=; b=ZSEM5KDeyBLQBASbVj0wUWJ0YqQeroLn4I2IOvmY0o/o73MyuFKrwMrvt96N+/0ZCHm1mJ SSLmoqOTnCzzfaXLMMH6Qe/FXO8D+3iW72RJZl3o3wcg9NUyFoxRJryws3TLWNB38yryu0 cIBX+8O7npN09i1J1OX0ycdqAM45d0tqhIzJCcxYIcrqHxmiswikmP80d3yFFu8sigbb6X 7OPkd1rL4YiSY4xy9vpO3q76uBuD3RMpsBtkVfYmlVwnJM52INOI7WYOQWCVIlNAb7qzXK 2lALyesqe0FBy1yS/Qt3m5TYZqob25TcyCPCH7vTuXe/3iMKQ+BN4ZuuOlU8Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673196394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0zflf/fzpUrdFZ5HnAUQTHExxt0ihih6wncbZA8/45g=; b=noyK/ArxKrneejgYLlUilKCAKxt1asv1NLFXixTLFmb6G5pNcWA1FHFDCoTP4m1AtWgmjF lrswmUyD2eDyIcCH9XYfJkyDA7BXWPED8rKOzTs4PBjlIObKR2p7osRJyxhYSH+KMlJgMs XaUrE0GYiR9b2VDmzL1+2XA7SmSAZJm9RC++GW1qc17tub9TH5TjueuryBLg2Z7rv0f2/q g7Jcrl9Rn/UGjdLaP6Gsj9i1Xt/GW4iUhJLfBMuNJ/dlVXJK6lni+90HGRz2ikoc7ap7Aq 8/9+LINKeqPwQEA8vBhuG9JakiOLkwYg/2mEYd0ohERhx5qyl8nElIOfJt5iyw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673196394; a=rsa-sha256; cv=none; b=LBsCine/W76A+U5ufAjsTryRFmgArh0l8E+gDvRVx75+NDw4JyBKDWVQ/jSNqfiHOUXtVJ oAuuiyou2vd2NATWcmkbYflojGlG9++lkQ4qHL6ZJL+Oji3xseyM/wPGLIt7Mv3CIdvl29 7gujBpr2g8hYL0oYSwN7yxi3i8CsVEOAsBxW9E6Nl4AD7P+GHr1RZOre/u2yKqC46k3QU9 yEbJVlETqaKP/faW1I7HkVXrPHOW9HBimJGzTn/N6UHmfQ3CmRz2e9rZu9mwX4xrJkYq66 /698OomPY05UlOUKTuUVXmCRpBalaYRmKQLYeOZxghELo9lhKhte44L2HjhG8g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Nqjdk2vSYzwHh; Sun, 8 Jan 2023 16:46:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 308GkYic018875; Sun, 8 Jan 2023 16:46:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 308GkY2r018874; Sun, 8 Jan 2023 16:46:34 GMT (envelope-from git) Date: Sun, 8 Jan 2023 16:46:34 GMT Message-Id: <202301081646.308GkY2r018874@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 71bbe6fb709d - main - stand/zfs: Add a third argument to zfs_probe_dev: part_too List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71bbe6fb709dcfbe36877fa53c928e2e6d881843 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=71bbe6fb709dcfbe36877fa53c928e2e6d881843 commit 71bbe6fb709dcfbe36877fa53c928e2e6d881843 Author: Warner Losh AuthorDate: 2022-12-16 23:19:51 +0000 Commit: Warner Losh CommitDate: 2023-01-08 16:45:11 +0000 stand/zfs: Add a third argument to zfs_probe_dev: part_too Pass in 'true' if you'd like to search this device's partitions or 'false' if you should just search the device. EFI and (in the future) kboot have discrete partitions that aren't accessed via the full disk device. Weird things happen if you try to search in these cases. Sponsored by: Netflix --- stand/efi/libefi/efizfs.c | 2 +- stand/i386/loader/main.c | 2 +- stand/i386/zfsboot/zfsboot.c | 4 ++-- stand/libsa/zfs/libzfs.h | 2 +- stand/libsa/zfs/zfs.c | 4 +++- stand/userboot/userboot/main.c | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/stand/efi/libefi/efizfs.c b/stand/efi/libefi/efizfs.c index 7f3986d47140..4fa336df1d59 100644 --- a/stand/efi/libefi/efizfs.c +++ b/stand/efi/libefi/efizfs.c @@ -115,7 +115,7 @@ efi_zfs_probe(void) snprintf(devname, sizeof(devname), "%s%dp%d:", efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit); guid = 0; - if (zfs_probe_dev(devname, &guid) == 0) { + if (zfs_probe_dev(devname, &guid, false) == 0) { insert_zfs(pd->pd_handle, guid); if (pd->pd_handle == boot_img->DeviceHandle) pool_guid = guid; diff --git a/stand/i386/loader/main.c b/stand/i386/loader/main.c index f3e1d4ff434d..e5cc766f5781 100644 --- a/stand/i386/loader/main.c +++ b/stand/i386/loader/main.c @@ -453,7 +453,7 @@ i386_zfs_probe(void) for (dev.dd.d_unit = 0; bd_unit2bios(&dev) >= 0; dev.dd.d_unit++) { snprintf(devname, sizeof(devname), "%s%d:", bioshd.dv_name, dev.dd.d_unit); - zfs_probe_dev(devname, NULL); + zfs_probe_dev(devname, NULL, true); } } #endif diff --git a/stand/i386/zfsboot/zfsboot.c b/stand/i386/zfsboot/zfsboot.c index c6305b41493e..da91fc3a5d20 100644 --- a/stand/i386/zfsboot/zfsboot.c +++ b/stand/i386/zfsboot/zfsboot.c @@ -706,9 +706,9 @@ i386_zfs_probe(void) dev.dd.d_unit); /* If this is not boot disk, use generic probe. */ if (dev.dd.d_unit != boot_unit) - zfs_probe_dev(devname, NULL); + zfs_probe_dev(devname, NULL, true); else - zfs_probe_dev(devname, &pool_guid); + zfs_probe_dev(devname, &pool_guid, true); if (pool_guid != 0 && bdev == NULL) { bdev = malloc(sizeof (struct i386_devdesc)); diff --git a/stand/libsa/zfs/libzfs.h b/stand/libsa/zfs/libzfs.h index b6b6cd78f073..d9758f49ab78 100644 --- a/stand/libsa/zfs/libzfs.h +++ b/stand/libsa/zfs/libzfs.h @@ -49,7 +49,7 @@ struct zfs_devdesc { }; char *zfs_fmtdev(struct devdesc *); -int zfs_probe_dev(const char *devname, uint64_t *pool_guid); +int zfs_probe_dev(const char *devname, uint64_t *pool_guid, bool part_too); int zfs_list(const char *name); int zfs_get_bootonce(void *, const char *, char *, size_t); int zfs_get_bootenv(void *, nvlist_t **); diff --git a/stand/libsa/zfs/zfs.c b/stand/libsa/zfs/zfs.c index d7aecc71ab5c..57fecf2f4d68 100644 --- a/stand/libsa/zfs/zfs.c +++ b/stand/libsa/zfs/zfs.c @@ -1492,7 +1492,7 @@ zfs_attach_nvstore(void *vdev) } int -zfs_probe_dev(const char *devname, uint64_t *pool_guid) +zfs_probe_dev(const char *devname, uint64_t *pool_guid, bool parts_too) { struct ptable *table; struct zfs_probe_args pa; @@ -1508,6 +1508,8 @@ zfs_probe_dev(const char *devname, uint64_t *pool_guid) ret = zfs_probe(pa.fd, pool_guid); if (ret == 0) return (0); + if (!parts_too) + return (ENXIO); /* Probe each partition */ ret = ioctl(pa.fd, DIOCGMEDIASIZE, &mediasz); diff --git a/stand/userboot/userboot/main.c b/stand/userboot/userboot/main.c index 6ec5c5ddbbb6..b403d9b48f56 100644 --- a/stand/userboot/userboot/main.c +++ b/stand/userboot/userboot/main.c @@ -313,7 +313,7 @@ userboot_zfs_probe(void) for (unit = 0; unit < userboot_disk_maxunit; unit++) { sprintf(devname, "disk%d:", unit); pool_guid = 0; - zfs_probe_dev(devname, &pool_guid); + zfs_probe_dev(devname, &pool_guid, true); if (pool_guid != 0) userboot_zfs_found = 1; }