From owner-svn-src-projects@FreeBSD.ORG Thu Jan 27 02:17:01 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4178106566B; Thu, 27 Jan 2011 02:17:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D338B8FC0C; Thu, 27 Jan 2011 02:17:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0R2H0Do097753; Thu, 27 Jan 2011 02:17:00 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0R2H0eh097751; Thu, 27 Jan 2011 02:17:00 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201101270217.p0R2H0eh097751@svn.freebsd.org> From: Warner Losh Date: Thu, 27 Jan 2011 02:17:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r217919 - projects/graid/head/sys/geom/raid X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2011 02:17:01 -0000 Author: imp Date: Thu Jan 27 02:17:00 2011 New Revision: 217919 URL: http://svn.freebsd.org/changeset/base/217919 Log: Don't call g_raid_iodone() on the parent bp we use to drive the rebuild process. Since g_raid didn't queue it to us, it freaks when we give it back. Tweak some debug levels, remove some debugs, etc. # now, we rebuild mostly correctly... just don't remove the disk being rebuilt # yet. Modified: projects/graid/head/sys/geom/raid/tr_raid1.c Modified: projects/graid/head/sys/geom/raid/tr_raid1.c ============================================================================== --- projects/graid/head/sys/geom/raid/tr_raid1.c Thu Jan 27 02:00:01 2011 (r217918) +++ projects/graid/head/sys/geom/raid/tr_raid1.c Thu Jan 27 02:17:00 2011 (r217919) @@ -544,7 +544,6 @@ g_raid_tr_iodone_raid1(struct g_raid_tr_ * inactive ones, we do 50MB. */ if (trs->trso_type == TR_RAID1_REBUILD) { - printf("Rebuild BIO\n"); vol = tr->tro_volume; pbp->bio_inbed++; if (bp->bio_cmd == BIO_READ) { @@ -552,7 +551,7 @@ g_raid_tr_iodone_raid1(struct g_raid_tr_ * The read operation finished, queue the * write and get out. */ - G_RAID_LOGREQ(1, bp, + G_RAID_LOGREQ(4, bp, "rebuild read done. Error %d", bp->bio_error); if (bp->bio_error != 0) { g_raid_tr_raid1_rebuild_abort(tr, vol); @@ -563,9 +562,8 @@ g_raid_tr_iodone_raid1(struct g_raid_tr_ cbp->bio_cflags = G_RAID_BIO_FLAG_SYNC; cbp->bio_offset = bp->bio_offset; /* Necessary? */ cbp->bio_length = bp->bio_length; - G_RAID_LOGREQ(1, bp, "Queueing reguild write."); + G_RAID_LOGREQ(4, bp, "Queueing reguild write."); g_raid_subdisk_iostart(trs->trso_failed_sd, cbp); - return; } else { /* * The write operation just finished. Do @@ -577,40 +575,39 @@ g_raid_tr_iodone_raid1(struct g_raid_tr_ * SD_REBUILD_CLUSTER should be small, that * shouldn't be a problem. */ - G_RAID_LOGREQ(1, bp, + G_RAID_LOGREQ(4, bp, "rebuild write done. Error %d", bp->bio_error); if (bp->bio_error != 0) { g_raid_tr_raid1_rebuild_abort(tr, vol); - goto out; + g_destroy_bio(pbp); + return; } /* XXX A lot of the following is needed when we kick of the work -- refactor */ nsd = trs->trso_failed_sd; - if (nsd == NULL) { - printf("WTF? nsd is null\n"); - goto out; - } g_raid_unlock_range(sd->sd_volume, bp->bio_offset, bp->bio_length); nsd->sd_rebuild_pos += pbp->bio_length; if (nsd->sd_rebuild_pos >= vol->v_mediasize) { g_raid_tr_raid1_rebuild_finish(tr, vol); - goto out; + g_destroy_bio(pbp); + return; } if (--trs->trso_recover_slabs == 0) { - goto out; + g_destroy_bio(pbp); + return; } pbp->bio_offset = nsd->sd_rebuild_pos; cbp = g_clone_bio(pbp); cbp->bio_cmd = BIO_READ; cbp->bio_cflags = G_RAID_BIO_FLAG_SYNC; cbp->bio_offset = nsd->sd_rebuild_pos; - cbp->bio_length = MIN(SD_REBUILD_SLAB, vol->v_mediasize - nsd->sd_rebuild_pos); + cbp->bio_length = MIN(SD_REBUILD_SLAB, + vol->v_mediasize - nsd->sd_rebuild_pos); cbp->bio_caller1 = trs->trso_good_sd; - G_RAID_LOGREQ(1, bp, + G_RAID_LOGREQ(4, bp, "Rebuild read at %jd.", cbp->bio_offset); g_raid_lock_range(sd->sd_volume, /* Lock callback starts I/O */ cbp->bio_offset, cbp->bio_length, cbp); - goto out; } } else if (trs->trso_type == TR_RAID1_RESYNC) { /* @@ -621,8 +618,8 @@ g_raid_tr_iodone_raid1(struct g_raid_tr_ */ panic("Somehow, we think we're doing a resync"); } + return; } - printf("Woof. bp is %p pbp is %p\n", bp, pbp); if (bp->bio_error != 0 && bp->bio_cmd == BIO_READ && pbp->bio_children == 1 && bp->bio_cflags == 0) { /* @@ -632,7 +629,7 @@ g_raid_tr_iodone_raid1(struct g_raid_tr_ */ vol = tr->tro_volume; sd->sd_read_errs++; - G_RAID_LOGREQ(1, bp, + G_RAID_LOGREQ(3, bp, "Read failure, attempting recovery. %d total read errs", sd->sd_read_errs); @@ -655,7 +652,7 @@ g_raid_tr_iodone_raid1(struct g_raid_tr_ cbp = g_clone_bio(pbp); if (cbp == NULL) break; - G_RAID_LOGREQ(3, cbp, "Retrying read"); + G_RAID_LOGREQ(2, cbp, "Retrying read"); g_raid_subdisk_iostart(nsd, cbp); pbp->bio_inbed++; return;