From patchwork Fri Mar 8 00:09:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matteo Frigo X-Patchwork-Id: 2235271 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork1.kernel.org (Postfix) with ESMTP id 438594006E for ; Fri, 8 Mar 2013 07:52:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r287nIb8023799; Fri, 8 Mar 2013 02:49:19 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2809f1Q020903 for ; Thu, 7 Mar 2013 19:09:42 -0500 Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.21]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2809fpo015615 for ; Thu, 7 Mar 2013 19:09:41 -0500 Received: from fftw.org (216.119.142.145.static.a2webhosting.com [216.119.142.145]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2809erZ003214 for ; Thu, 7 Mar 2013 19:09:40 -0500 Received: from c-24-62-102-245.hsd1.ma.comcast.net ([24.62.102.245] helo=amd) by fftw.org with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1UDksU-0001HP-6O; Thu, 07 Mar 2013 19:09:38 -0500 Received: from athena by amd with local (Exim 4.80) (envelope-from ) id 1UDksN-0008Ro-Rt; Thu, 07 Mar 2013 19:09:31 -0500 From: Matteo Frigo To: Dave Chinner References: <87d2vnc34r.fsf@fftw.org> <20130226044039.GM5551@dastard> <20130227010414.GD1514@agk.fab.redhat.com> <20130227014900.GY5551@dastard> <87y5eah4xz.fsf@fftw.org> <87k3pjs908.fsf@fftw.org> <20130307223140.GU23616@dastard> Date: Thu, 07 Mar 2013 19:09:31 -0500 In-Reply-To: <20130307223140.GU23616@dastard> (Dave Chinner's message of "Fri, 8 Mar 2013 09:31:40 +1100") Message-ID: <87hakmpxac.fsf@fftw.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 X-RedHat-Spam-Score: -1.901 (BAYES_00, SPF_HELO_PASS, SPF_PASS, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.21 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Fri, 08 Mar 2013 02:49:16 -0500 Cc: dm-devel@redhat.com, xfs@oss.sgi.com Subject: Re: [dm-devel] [BUG] pvmove corrupting XFS filesystems (was Re: [BUG] Internal error xfs_dir2_data_reada_verify) X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Dave Chinner writes: > You need the XFS patch I posted so that readahead buffer > verification is avoided in the case of an error being returned from > the readahead. I apologize if I was not clear in my previous post. I mean to say that returning -EIO from dm, even in conjunction with your patch, is not sufficient to fix the problem. Specifically, I repeated the experiment with v3.8.2 patched as discussed below, running my original script (repeated here for completeness): pvcreate /dev/vd[bc] vgcreate test /dev/vd[bc] lvcreate -L 8G -n vol test /dev/vdb mkfs.xfs -f /dev/mapper/test-vol mount -o noatime /dev/mapper/test-vol /mnt cd /mnt git clone ~/linux-stable cd / umount /mnt mount -o noatime /dev/mapper/test-vol /mnt pvmove -b /dev/vdb /dev/vdc sleep 2 rm -rf /mnt/linux-stable I obtained a string of errors that starts with this: [ 166.596574] XFS (dm-1): metadata I/O error: block 0x805060 ("xfs_trans_read_buf_map") error 5 numblks 8 [ 166.599556] XFS (dm-1): metadata I/O error: block 0x805060 ("xfs_trans_read_buf_map") error 5 numblks 8 [ 166.604845] XFS (dm-1): metadata I/O error: block 0x5285b8 ("xfs_trans_read_buf_map") error 5 numblks 8 [ 166.607894] XFS (dm-1): metadata I/O error: block 0x5285b8 ("xfs_trans_read_buf_map") error 5 numblks 8 [ 166.614242] XFS (dm-1): metadata I/O error: block 0x54f2b0 ("xfs_trans_read_buf_map") error 5 numblks 8 [ 166.617307] XFS (dm-1): metadata I/O error: block 0x54f2b0 ("xfs_trans_read_buf_map") error 5 numblks 8 [ 166.651373] XFS (dm-1): Corruption detected. Unmount and run xfs_repair [ 166.653517] XFS (dm-1): Corruption detected. Unmount and run xfs_repair [ 166.655545] XFS (dm-1): Corruption detected. Unmount and run xfs_repair [ 166.657614] XFS (dm-1): Corruption detected. Unmount and run xfs_repair [ 166.659685] XFS (dm-1): Corruption detected. Unmount and run xfs_repair [ 166.661731] XFS (dm-1): Corruption detected. Unmount and run xfs_repair [ 166.663761] XFS (dm-1): Corruption detected. Unmount and run xfs_repair I used v3.8.2 with the following diff, including both your xfs patch and my attempt to patch dm-raid1 to return EIO: So your patch is not sufficient to fix the problem, even if dm returns -EIO instead of -EAGAIN. My question is, what is dm supposed to return? Regards, MF --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index fa51918..88903e3 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c @@ -1169,7 +1169,7 @@ static int mirror_map(struct dm_target *ti, struct bio *bio) */ if (!r || (r == -EWOULDBLOCK)) { if (rw == READA) - return -EWOULDBLOCK; + return -EIO; queue_bio(ms, bio, rw); return DM_MAPIO_SUBMITTED; diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index fbbb9eb..c961dd4 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1024,7 +1024,9 @@ xfs_buf_iodone_work( bool read = !!(bp->b_flags & XBF_READ); bp->b_flags &= ~(XBF_READ | XBF_WRITE | XBF_READ_AHEAD); - if (read && bp->b_ops) + + /* only validate buffers that were read without errors */ + if (read && bp->b_ops && !bp->b_error && (bp->b_flags & XBF_DONE)) bp->b_ops->verify_read(bp); if (bp->b_iodone)