summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/geom/mirror/g_mirror.c14
-rw-r--r--sys/geom/mirror/g_mirror.h4
2 files changed, 15 insertions, 3 deletions
diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c
index 21efd81..3f60fd2 100644
--- a/sys/geom/mirror/g_mirror.c
+++ b/sys/geom/mirror/g_mirror.c
@@ -440,7 +440,7 @@ g_mirror_init_disk(struct g_mirror_softc *sc, struct g_provider *pp,
struct g_mirror_metadata *md, int *errorp)
{
struct g_mirror_disk *disk;
- int error;
+ int i, error;
disk = malloc(sizeof(*disk), M_MIRROR, M_NOWAIT | M_ZERO);
if (disk == NULL) {
@@ -455,6 +455,11 @@ g_mirror_init_disk(struct g_mirror_softc *sc, struct g_provider *pp,
disk->d_state = G_MIRROR_DISK_STATE_NONE;
disk->d_priority = md->md_priority;
disk->d_flags = md->md_dflags;
+ error = g_getattr("GEOM::candelete", disk->d_consumer, &i);
+ if (error != 0)
+ goto fail;
+ if (i)
+ disk->d_flags |= G_MIRROR_DISK_FLAG_CANDELETE;
if (md->md_provider[0] != '\0')
disk->d_flags |= G_MIRROR_DISK_FLAG_HARDCODED;
disk->d_sync.ds_consumer = NULL;
@@ -1085,7 +1090,9 @@ g_mirror_start(struct bio *bp)
g_mirror_flush(sc, bp);
return;
case BIO_GETATTR:
- if (strcmp("GEOM::kerneldump", bp->bio_attribute) == 0) {
+ if (g_handleattr_int(bp, "GEOM::candelete", 1))
+ return;
+ else if (strcmp("GEOM::kerneldump", bp->bio_attribute) == 0) {
g_mirror_kernel_dump(bp);
return;
}
@@ -1632,6 +1639,9 @@ g_mirror_register_request(struct bio *bp)
default:
continue;
}
+ if (bp->bio_cmd == BIO_DELETE &&
+ (disk->d_flags & G_MIRROR_DISK_FLAG_CANDELETE) == 0)
+ continue;
cbp = g_clone_bio(bp);
if (cbp == NULL) {
for (cbp = bioq_first(&queue); cbp != NULL;
diff --git a/sys/geom/mirror/g_mirror.h b/sys/geom/mirror/g_mirror.h
index c6fec74..44ea18a 100644
--- a/sys/geom/mirror/g_mirror.h
+++ b/sys/geom/mirror/g_mirror.h
@@ -59,10 +59,12 @@
#define G_MIRROR_DISK_FLAG_INACTIVE 0x0000000000000008ULL
#define G_MIRROR_DISK_FLAG_HARDCODED 0x0000000000000010ULL
#define G_MIRROR_DISK_FLAG_BROKEN 0x0000000000000020ULL
+#define G_MIRROR_DISK_FLAG_CANDELETE 0x0000000000000040ULL
#define G_MIRROR_DISK_FLAG_MASK (G_MIRROR_DISK_FLAG_DIRTY | \
G_MIRROR_DISK_FLAG_SYNCHRONIZING | \
G_MIRROR_DISK_FLAG_FORCE_SYNC | \
- G_MIRROR_DISK_FLAG_INACTIVE)
+ G_MIRROR_DISK_FLAG_INACTIVE | \
+ G_MIRROR_DISK_FLAG_CANDELETE)
#define G_MIRROR_DEVICE_FLAG_NOAUTOSYNC 0x0000000000000001ULL
#define G_MIRROR_DEVICE_FLAG_NOFAILSYNC 0x0000000000000002ULL
OpenPOWER on IntegriCloud