Btrfs: loop waiting on writeback
authorChris Mason <chris.mason@oracle.com>
Wed, 21 Mar 2012 16:09:56 +0000 (12:09 -0400)
committerChris Mason <chris.mason@oracle.com>
Mon, 26 Mar 2012 21:04:23 +0000 (17:04 -0400)
lock_extent_buffer_for_io needs to loop around and make sure the
writeback bits are not set.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent_io.c

index c1b898d590d70e957c20c4d594f8045340af2bd4..b71cc4547d4746d8d761aaa46e391a4a54d8c53f 100644 (file)
@@ -3010,12 +3010,12 @@ static int lock_extent_buffer_for_io(struct extent_buffer *eb,
                        flush_write_bio(epd);
                        flush = 1;
                }
-               wait_on_extent_buffer_writeback(eb);
-               btrfs_tree_lock(eb);
-               if (test_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags)) {
-                       printk(KERN_ERR "Um, ok?\n");
+               while (1) {
+                       wait_on_extent_buffer_writeback(eb);
+                       btrfs_tree_lock(eb);
+                       if (!test_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags))
+                               break;
                        btrfs_tree_unlock(eb);
-                       return 0;
                }
        }