freebsd-nq/sys/geom
Peter Jeremy a65f526add
geom_gate: Distinguish between classes of errors
The geom_gate API provides 2 distinct paths for exchanging error
details between the kernel and the userland client: Including an error
code in the g_gate_ctl_io structure passed in the ioctl(2) call or
having the ioctl(2) call return -1 with an error code in errno. The
latter reflects errors in the ioctl(2) call itself whilst the former
reflects errors within the geom_gate instance.

The G_GATE_CMD_START ioctl blocks waiting for an I/O request to be
directed to the geom_gate instance and the wait can fail
(necessitating an error return) if the geom_gate instance is destroyed
or if the msleep(9) fails. The code previously treated both error
cases indentically: Returning ECANCELED as a geom_gate instance error
(which the ggatec treats as a fatal error).  Whilst this is the correct
behaviour if the geom_gate instance is destroyed, a msleep(9) failure
is unrelated to the geom_gate instance itself and should be reported
as an ioctl(2) "failure".  The distinction is important because
msleep(9) can return ERESTART, which means the system call should be
retried (and this will occur automatically as part of the generic
syscall return processing).

This change alters the msleep(9) handling to directly return the error
code from msleep(9), which ensures ERESTART is correctly handled,
rather than being treated as a fatal error.

Reviewed by:    Johannes Totz <jo@bruelltuete.com>
Differential Revision:  https://reviews.freebsd.org/D33996

(cherry picked from commit afcd121024)
2022-03-05 13:52:24 +11:00
..
bde gbde: replace malloc_last_fail with a kludge 2020-11-12 20:20:57 +00:00
cache GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
concat GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
eli eli: Zero pad bytes that arise when certain auth algorithms are used 2021-07-29 08:12:22 -04:00
gate geom_gate: Distinguish between classes of errors 2022-03-05 13:52:24 +11:00
journal GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
label glabel: Set G_CF_DIRECT_SEND/RECEIVE for taste consumer. 2022-02-10 19:50:46 -05:00
linux_lvm GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
mirror g_mirror: don't fail reads while losing next-to-last disk 2022-02-17 08:46:14 +02:00
mountver Make g_attach() return ENXIO for orphaned providers; update various 2020-10-18 16:24:08 +00:00
multipath GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
nop Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
part geom: Add HiFive boot partitions 2022-02-09 12:39:50 -05:00
raid graid: Set G_CF_DIRECT_SEND for task consumer. 2022-02-10 19:50:45 -05:00
raid3 GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
shsec GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
stripe GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
uzip Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
vinum GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
virstor GEOM: Set G_CF_DIRECT_SEND/RECEIVE for taste consumers. 2022-02-10 19:50:46 -05:00
zero geom(4): Mark all sysctls as CTLFLAG_MPSAFE. 2021-08-24 21:53:17 -04:00
geom_bsd_enc.c
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_ctl.c: remove stale header files 2020-10-20 20:59:13 +00:00
geom_ctl.h
geom_dbg.h
geom_dev.c geom: add kqfilter support for geom dev 2022-02-23 08:26:49 -09:00
geom_disk.c geom_disk: use a preallocated geom_event for disk destruction. 2021-09-12 09:56:14 -06:00
geom_disk.h geom_disk: use a preallocated geom_event for disk destruction. 2021-09-12 09:56:14 -06: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: Minor polishing in geom_event. 2022-01-10 21:45:30 -05:00
geom_flashmap.c
geom_flashmap.h geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_int.h GEOM: Relax direct dispatch for GEOM threads. 2022-02-10 19:50:45 -05:00
geom_io.c In GEOM debugging output, show consumer for cloned and duplicated bio's. 2022-02-15 16:27:55 -08:00
geom_kern.c GEOM: Relax direct dispatch for GEOM threads. 2022-02-10 19:50:45 -05: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
geom_slice.h
geom_subr.c geom(4): make g_newprovider_event() return if G_P_WITHER is set 2020-12-29 14:29:59 +00:00
geom_vfs.c g_vfs_close(): vp is unused 2021-11-19 06:25:29 +02:00
geom_vfs.h
geom.h GEOM: Minor polishing in geom_event. 2022-01-10 21:45:30 -05:00
notes