summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_disk.h
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>2016-06-21 20:18:19 +0000
committerken <ken@FreeBSD.org>2016-06-21 20:18:19 +0000
commit68b33bd3972c7d301511a41952891a61f76f7d22 (patch)
treeb94af526ae1201a5dd1cc8fdd3e1aa9e5ed06f81 /sys/geom/geom_disk.h
parent2cb7769e5b57bc90936011bf9013d8705fd9ac4b (diff)
downloadFreeBSD-src-68b33bd3972c7d301511a41952891a61f76f7d22.zip
FreeBSD-src-68b33bd3972c7d301511a41952891a61f76f7d22.tar.gz
Fix a bug that caused da(4) instances to hang around after the underlying
device is gone. The problem was that when disk_gone() is called, if the GEOM disk creation process has not yet happened, the withering process couldn't start. We didn't record any state in the GEOM disk code, and so the d_gone() callback to the da(4) driver never happened. The solution is to track the state of the creation process, and initiate the withering process from g_disk_create() if the disk is being created. This change does add fields to struct disk, and so I have bumped DISK_VERSION. geom_disk.c: Track where we are in the disk creation process, and check to see whether our underlying disk has gone away or not. In disk_gone(), set a new d_goneflag variable that g_disk_create() can check to see if it needs to clean up the disk instance. geom_disk.h: Add a mutex to struct disk (for internal use) disk init level, and a gone flag. Bump DISK_VERSION because the size of struct disk has changed and fields have been added at the beginning. Sponsored by: Spectra Logic Approved by: re (marius)
Diffstat (limited to 'sys/geom/geom_disk.h')
-rw-r--r--sys/geom/geom_disk.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/geom/geom_disk.h b/sys/geom/geom_disk.h
index 97faeed..8549348 100644
--- a/sys/geom/geom_disk.h
+++ b/sys/geom/geom_disk.h
@@ -60,11 +60,21 @@ typedef int disk_ioctl_t(struct disk *, u_long cmd, void *data,
struct g_geom;
struct devstat;
+typedef enum {
+ DISK_INIT_NONE,
+ DISK_INIT_START,
+ DISK_INIT_DONE
+} disk_init_level;
+
struct disk {
/* Fields which are private to geom_disk */
struct g_geom *d_geom;
struct devstat *d_devstat;
+ int d_goneflag;
int d_destroyed;
+ struct mtx d_mtx;
+ char d_mtx_name[24];
+ disk_init_level d_init_level;
/* Shared fields */
u_int d_flags;
@@ -125,7 +135,8 @@ int disk_resize(struct disk *dp, int flag);
#define DISK_VERSION_02 0x5856105b
#define DISK_VERSION_03 0x5856105c
#define DISK_VERSION_04 0x5856105d
-#define DISK_VERSION DISK_VERSION_04
+#define DISK_VERSION_05 0x5856105e
+#define DISK_VERSION DISK_VERSION_05
#endif /* _KERNEL */
#endif /* _GEOM_GEOM_DISK_H_ */
OpenPOWER on IntegriCloud