From patchwork Fri Mar 8 01:57:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 2234291 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 966A940077 for ; Fri, 8 Mar 2013 02:01:09 +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 r281vvor003494; Thu, 7 Mar 2013 20:57:58 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r281vu2x032336 for ; Thu, 7 Mar 2013 20:57:56 -0500 Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.21]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r281vuOX010049 for ; Thu, 7 Mar 2013 20:57:56 -0500 Received: from ipmail05.adl6.internode.on.net (ipmail05.adl6.internode.on.net [150.101.137.143]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r281vqXR009782 for ; Thu, 7 Mar 2013 20:57:53 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AngZABxEOVF5LAvR/2dsb2JhbABEhz23eYUWAQIBgV4XdIIsAQEFJxMcIxAIAw4HAwkaCw8FJQMhE4gSu2YVjXYYH0oHgl9hA5ZKiWeHC4FTgUo Received: from ppp121-44-11-209.lns20.syd6.internode.on.net (HELO dastard) ([121.44.11.209]) by ipmail05.adl6.internode.on.net with ESMTP; 08 Mar 2013 12:27:50 +1030 Received: from dave by dastard with local (Exim 4.76) (envelope-from ) id 1UDmYl-0006vo-P7; Fri, 08 Mar 2013 12:57:23 +1100 Date: Fri, 8 Mar 2013 12:57:23 +1100 From: Dave Chinner To: Matteo Frigo Message-ID: <20130308015723.GA23616@dastard> 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> <87hakmpxac.fsf@fftw.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87hakmpxac.fsf@fftw.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-RedHat-Spam-Score: -2.308 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_NONE, SPF_FAIL, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.21 X-loop: dm-devel@redhat.com 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 On Thu, Mar 07, 2013 at 07:09:31PM -0500, Matteo Frigo wrote: > 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 Add the the patch below. If you still see errors, then they are real IO errors from the block device. Cheers, Dave. diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 50eb603..82b70bd 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1336,6 +1336,12 @@ _xfs_buf_ioapply( int size; int i; + /* + * Make sure we capture only current IO errors rather than stale errors + * left over from previous use of the buffer (e.g. failed readahead). + */ + bp->b_error = 0; + if (bp->b_flags & XBF_WRITE) { if (bp->b_flags & XBF_SYNCIO) rw = WRITE_SYNC;