@@ -864,12 +863,12 @@ EXPORT_SYMBOL(mark_buffer_dirty_inode);
* dirtied buffers don't. After all, we don't want fsync to last
* forever if somebody is actively writing to the file.
*
- * Do this in two main stages: first we copy dirty buffers to a
- * temporary inode list, queueing the writes as we go. Then we clean
- * up, waiting for those writes to complete.
+ * Do this in three stages: first we copy dirty buffers to a
+ * temporary inode list, second we queue the writes. Then we wait
+ * for those writes to complete.
*
- * During this second stage, any subsequent updates to the file may end
- * up refiling the buffer on the original inode's dirty list again, so
+ * During the second or third stage, any subsequent updates to the file may
+ * end up refiling the buffer on the original inode's dirty list again, so
* there is a chance we will end up with a buffer queued for write but
* not yet completed on that list. So, as a final cleanup we go through
* the osync code to catch these locked, dirty buffers without requeuing
@@ -878,29 +877,32 @@ EXPORT_SYMBOL(mark_buffer_dirty_inode);
int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
{
struct buffer_head *bh;
- struct list_head tmp;
+ LIST_HEAD(wait);
+ struct list_head *entry;
int err = 0, err2;