freebsd-dev/sys/geom
Eugene Grosbein cea05ed9a9 geom_part: extend kern.geom.part.check_integrity to work on GPT
There are multiple USB/SATA bridges on the market that unconditionally
cut some LBAs off connected media. This could be a problem
for pre-partitioned drives so GEOM complains and does not create
devices in /dev for slices/partitions preventing access to existing data.

We have kern.geom.part.check_integrity that allows us to correct
partitioning if changed from default 1 to 0 but it works for MBR only.
If backup copy of GPT is unavailable due to decreases number of LBAs,
kernel still does not give access to partitions and prints to dmesg:

GEOM: md0: corrupt or invalid GPT detected.
GEOM: md0: GPT rejected -- may not be recoverable.

This change makes it work for GPT too, so it created partitions in /dev
and prints to dmesg this instead:

GEOM: md0: the secondary GPT table is corrupt or invalid.
GEOM: md0: using the primary only -- recovery suggested.

Then "gpart recover" re-created backup copy of GPT
and allows further manipulations with partitions.

This change is no-op for default configuration having
kern.geom.part.check_integrity=1

Reported by:	Alex Korchmar
MFC after:	3 days.
2020-09-08 22:23:53 +00:00
..
bde geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
cache geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
concat geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
eli geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
gate geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
journal sys/geom: consistently use _PATH_DEV instead of hardcoding "/dev/". 2020-07-09 02:52:39 +00:00
label geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
linux_lvm Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
mirror geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
mountver geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
multipath geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
nop geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
part geom_part: extend kern.geom.part.check_integrity to work on GPT 2020-09-08 22:23:53 +00:00
raid geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
raid3 geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
shsec Use explicit_bzero() instead of bzero() for sensitive data. 2020-06-25 20:25:35 +00:00
stripe Consistently use gctl_get_provider instead of home-grown variants. 2020-07-22 02:15:21 +00:00
uzip geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
vinum geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
virstor geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
zero geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_bsd_enc.c sys/geom: adoption of SPDX licensing ID tags. 2017-11-27 15:17:37 +00:00
geom_ccd.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_ctl.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_ctl.h Define a constant for the maximum number of GEOM_CTL arguments. 2019-02-20 17:07:08 +00:00
geom_dbg.h GEOM: Reduce unnecessary log interleaving with sbufs 2019-08-07 19:28:35 +00:00
geom_dev.c Retire devctl_notify_f() 2020-08-29 04:30:06 +00:00
geom_disk.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_disk.h Add GEOM attribute to report physical device name, and report it 2019-11-09 17:30:19 +00:00
geom_dump.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_event.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_flashmap.c Remove NAND and NANDFS support 2019-06-25 04:50:09 +00:00
geom_flashmap.h geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_int.h Remove duplicate g_debugflags declaration. 2019-12-05 15:07:32 +00:00
geom_io.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_kern.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_map.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_redboot.c geom_map and geom_redboot: Remove unused ctlreq handler. 2020-07-26 22:30:01 +00:00
geom_slice.c Pass BIO_SPEEDUP through all the geom layers 2020-01-17 01:15:55 +00:00
geom_slice.h sys/geom: adoption of SPDX licensing ID tags. 2017-11-27 15:17:37 +00:00
geom_subr.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_vfs.c This commit enables a UFS filesystem to do a forcible unmount when 2020-05-25 23:47:31 +00:00
geom_vfs.h sys/geom: adoption of SPDX licensing ID tags. 2017-11-27 15:17:37 +00:00
geom.h gctl_get_geom: Skip validation of g_class. 2020-07-26 22:30:55 +00:00
notes