[PATCH] xfs: using extsize cause corruption with multi buffer page.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  This mod make sure that buffer in a xfs_ioend are all in the
same extent. This is actually similar to what is done in
xfs_convert_page() already.

This solve the problem of having multiple extent in one page.

With the current kernel if we have a page that look like this:
buffer  content
0       empty  b_state = 0
1       DATA   b_state = 0x1023
2       DATA   b_state = 0x1023
3       empty  b_state = 0
4       empty  b_state = 0
5       DATA   b_state = 0x1023
6       DATA   b_state = 0x1023
7       empty  b_state = 0


We endup with buffer 1-4 been tag as real and 5-EOF tag as unwritten.
Instead of 1-2 real, 3-4 unwritten, 5-6 real, 7-EOF unwritten.

Signed-off-by: Alain Renaud <arenaud@xxxxxxx>

---
 fs/xfs/xfs_aops.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index ae31c31..88df6cb 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -896,6 +896,7 @@ xfs_vm_writepage(
 	int			err, imap_valid = 0, uptodate = 1;
 	int			count = 0;
 	int			nonblocking = 0;
+	int			new_ioend = 0;
 
 	trace_xfs_writepage(inode, page, 0);
 
@@ -947,7 +948,6 @@ xfs_vm_writepage(
 		nonblocking = 1;
 
 	do {
-		int new_ioend = 0;
 
 		if (offset >= end_offset)
 			break;
@@ -962,6 +962,7 @@ xfs_vm_writepage(
 		 */
 		if (!buffer_mapped(bh) && buffer_uptodate(bh)) {
 			imap_valid = 0;
+			new_ioend = 1;
 			continue;
 		}
 
@@ -985,6 +986,7 @@ xfs_vm_writepage(
 				ASSERT(buffer_mapped(bh));
 				imap_valid = 0;
 			}
+			new_ioend = 1;
 			continue;
 		}
 
@@ -1013,6 +1015,7 @@ xfs_vm_writepage(
 			xfs_add_to_ioend(inode, bh, offset, type, &ioend,
 					 new_ioend);
 			count++;
+			new_ioend = 0;
 		}
 
 		if (!iohead)
-- 
1.7.4.1

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux