Author: markj Date: Wed Jan 2 15:52:16 2019 New Revision: 342687 URL: https://svnweb.freebsd.org/changeset/base/342687
Log: Use g_handleattr() to reply to GEOM::candelete queries. g_handleattr() fills out bp->bio_completed; otherwise, g_getattr() returns an error in response to the query. This caused BIO_DELETE support to not be propagated through stacked configurations, e.g., a gconcat of gmirror volumes would not handle BIO_DELETE even when the gmirrors do. g_io_getattr() was not affected by the problem. PR: 232676 Reported and tested by: [email protected] MFC after: 1 week Modified: head/sys/geom/concat/g_concat.c head/sys/geom/mirror/g_mirror.c head/sys/geom/raid/g_raid.c Modified: head/sys/geom/concat/g_concat.c ============================================================================== --- head/sys/geom/concat/g_concat.c Wed Jan 2 15:36:35 2019 (r342686) +++ head/sys/geom/concat/g_concat.c Wed Jan 2 15:52:16 2019 (r342687) @@ -210,20 +210,16 @@ g_concat_candelete(struct bio *bp) { struct g_concat_softc *sc; struct g_concat_disk *disk; - int i, *val; + int i, val; - val = (int *)bp->bio_data; - *val = 0; - sc = bp->bio_to->geom->softc; for (i = 0; i < sc->sc_ndisks; i++) { disk = &sc->sc_disks[i]; - if (!disk->d_removed && disk->d_candelete) { - *val = 1; + if (!disk->d_removed && disk->d_candelete) break; - } } - g_io_deliver(bp, 0); + val = i < sc->sc_ndisks; + g_handleattr(bp, "GEOM::candelete", &val, sizeof(val)); } static void Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Wed Jan 2 15:36:35 2019 (r342686) +++ head/sys/geom/mirror/g_mirror.c Wed Jan 2 15:52:16 2019 (r342687) @@ -1086,16 +1086,15 @@ g_mirror_candelete(struct bio *bp) { struct g_mirror_softc *sc; struct g_mirror_disk *disk; - int *val; + int val; sc = bp->bio_to->private; LIST_FOREACH(disk, &sc->sc_disks, d_next) { if (disk->d_flags & G_MIRROR_DISK_FLAG_CANDELETE) break; } - val = (int *)bp->bio_data; - *val = (disk != NULL); - g_io_deliver(bp, 0); + val = disk != NULL; + g_handleattr(bp, "GEOM::candelete", &val, sizeof(val)); } static void Modified: head/sys/geom/raid/g_raid.c ============================================================================== --- head/sys/geom/raid/g_raid.c Wed Jan 2 15:36:35 2019 (r342686) +++ head/sys/geom/raid/g_raid.c Wed Jan 2 15:52:16 2019 (r342687) @@ -1075,23 +1075,19 @@ g_raid_candelete(struct g_raid_softc *sc, struct bio * struct g_provider *pp; struct g_raid_volume *vol; struct g_raid_subdisk *sd; - int *val; - int i; + int i, val; - val = (int *)bp->bio_data; pp = bp->bio_to; vol = pp->private; - *val = 0; for (i = 0; i < vol->v_disks_count; i++) { sd = &vol->v_subdisks[i]; if (sd->sd_state == G_RAID_SUBDISK_S_NONE) continue; - if (sd->sd_disk->d_candelete) { - *val = 1; + if (sd->sd_disk->d_candelete) break; - } } - g_io_deliver(bp, 0); + val = i < vol->v_disks_count; + g_handleattr(bp, "GEOM::candelete", &val, sizeof(val)); } static void _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "[email protected]"
