rpms/kernel/devel xfs-barrier-fix.patch, NONE, 1.1 kernel.spec, 1.1032, 1.1033

Eric Sandeen sandeen at fedoraproject.org
Thu Oct 9 15:44:51 UTC 2008


Author: sandeen

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv31469

Modified Files:
	kernel.spec 
Added Files:
	xfs-barrier-fix.patch 
Log Message:
* Thu Oct 09 2008 Eric Sandeen <sandeen at redhat.com>
- Fix for xfs wrongly disabling barriers while running


xfs-barrier-fix.patch:

--- NEW FILE xfs-barrier-fix.patch ---
Currently we disable barriers as soon as we get a buffer in xlog_iodone
that has the XBF_ORDERED flag cleared.  But this can be the case not only
for buffers where the barrier failed, but also the first buffer of a
split log write in case of a log wraparound.  Due to the disabled
barriers we can easily get directory corruption on unclean shutdowns.
So instead of using this check add a new buffer flag for failed barrier
writes.

This is a regression vs 2.6.26 caused by patch to use the right macro
to check for the ORDERED flag, as we previously got true returned for
every buffer.

Thanks to Toei Rei for reporting the bug.


Signed-off-by: Christoph Hellwig <hch at lst.de>

Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_buf.c	2008-10-09 13:36:50.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_buf.c	2008-10-09 13:38:38.000000000 +0200
@@ -1007,6 +1007,7 @@ xfs_buf_iodone_work(
 	    (bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) {
 		XB_TRACE(bp, "ordered_retry", bp->b_iodone);
 		bp->b_flags &= ~XBF_ORDERED;
+		bp->b_flags |= _XFS_BARRIER_FAILED;
 		xfs_buf_iorequest(bp);
 	} else if (bp->b_iodone)
 		(*(bp->b_iodone))(bp);
Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_buf.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_buf.h	2008-10-09 13:36:50.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_buf.h	2008-10-09 13:38:15.000000000 +0200
@@ -85,6 +85,14 @@ typedef enum {
 	 * modifications being lost.
 	 */
 	_XBF_PAGE_LOCKED = (1 << 22),
+
+	/*
+	 * If we try a barrier write, but it fails we have to communicate
+	 * this to the upper layers.  Unfortunately b_error gets overwritten
+	 * when the buffer is re-issued so we have to add another flag to
+	 * keep this information.
+	 */
+	_XFS_BARRIER_FAILED = (1 << 23),
 } xfs_buf_flags_t;
 
 typedef enum {
Index: linux-2.6-xfs/fs/xfs/xfs_log.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_log.c	2008-10-09 13:38:44.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/xfs_log.c	2008-10-09 13:39:32.000000000 +0200
@@ -1037,7 +1037,8 @@ xlog_iodone(xfs_buf_t *bp)
 	 * layer, it means the underlyin device no longer supports
 	 * barrier I/O. Warn loudly and turn off barriers.
 	 */
-	if ((l->l_mp->m_flags & XFS_MOUNT_BARRIER) && !XFS_BUF_ISORDERED(bp)) {
+	if (bp->b_flags & _XFS_BARRIER_FAILED) {
+		bp->b_flags &= ~_XFS_BARRIER_FAILED;
 		l->l_mp->m_flags &= ~XFS_MOUNT_BARRIER;
 		xfs_fs_cmn_err(CE_WARN, l->l_mp,
 				"xlog_iodone: Barriers are no longer supported"





Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1032
retrieving revision 1.1033
diff -u -r1.1032 -r1.1033
--- kernel.spec	9 Oct 2008 02:43:56 -0000	1.1032
+++ kernel.spec	9 Oct 2008 15:44:21 -0000	1.1033
@@ -683,6 +683,9 @@
 Patch2900: percpu_counter_sum_cleanup.patch
 Patch2901: ext4-patch-queue.patch
 
+# Fix for xfs wrongly disabling barriers
+Patch2902: xfs-barrier-fix.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1092,6 +1095,8 @@
 ApplyPatch percpu_counter_sum_cleanup.patch
 # Pending ext4 patch queue, minus fiemap, includes s/ext4dev/ext4
 ApplyPatch ext4-patch-queue.patch
+# xfs
+ApplyPatch xfs-barrier-fix.patch
 
 # USB
 ApplyPatch linux-2.6-usb-ehci-hcd-respect-nousb.patch
@@ -1806,6 +1811,9 @@
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Thu Oct 09 2008 Eric Sandeen <sandeen at redhat.com>
+- Fix for xfs wrongly disabling barriers while running.
+
 * Wed Oct 08 2008 Dave Jones <davej at redhat.com>
 - The mptfusion/vmware patch isn't needed after all. (#466071)
 




More information about the scm-commits mailing list