git: a34fda8a5d1a - stable/13 - geli: Move check for DEVT_DISK into geli_probe_and_attach
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Jan 2023 22:12:52 UTC
The branch stable/13 has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=a34fda8a5d1a8dea30a0883689e59c9d64f9e37c
commit a34fda8a5d1a8dea30a0883689e59c9d64f9e37c
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-10-22 00:16:56 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-24 21:49:36 +0000
geli: Move check for DEVT_DISK into geli_probe_and_attach
We only work on DEVT_DISK disks, so move that into the probe to drive
the point home better.
Sponsored by: Netflix
(cherry picked from commit bb3230e40bea68c1a0fc9ba1bee204bc05d7ea78)
---
stand/common/devopen.c | 4 +---
stand/libsa/geli/gelidev.c | 3 +++
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/stand/common/devopen.c b/stand/common/devopen.c
index 8fd2c1796555..4fd955d5a9eb 100644
--- a/stand/common/devopen.c
+++ b/stand/common/devopen.c
@@ -63,9 +63,7 @@ devopen(struct open_file *f, const char *fname, const char **file)
* pw if needed), this will attach the geli code to the open_file by
* replacing f->f_dev and f_devdata with pointers to a geli_devdesc.
*/
- if (f->f_dev->dv_type == DEVT_DISK) {
- geli_probe_and_attach(f);
- }
+ geli_probe_and_attach(f);
#endif
return (0);
diff --git a/stand/libsa/geli/gelidev.c b/stand/libsa/geli/gelidev.c
index 2dd686c81883..23ded496c23d 100644
--- a/stand/libsa/geli/gelidev.c
+++ b/stand/libsa/geli/gelidev.c
@@ -301,6 +301,9 @@ geli_probe_and_attach(struct open_file *f)
hdesc = (struct disk_devdesc *)(f->f_devdata);
+ /* We only work on DEVT_DISKs */
+ if (hdesc->dd.d_dev->dv_type != DEVT_DISK)
+ return;
/* Get the last block number for the host provider. */
if (hdesc->dd.d_dev->dv_ioctl(f, DIOCGMEDIASIZE, &hmediasize) != 0)
return;