History

Merge tag 'writeback-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/wfg/linux

Pull writeback fix from Wu Fengguang: "Fix data corruption on NFS writeback. It has been in linux-next for one month" * tag 'writeback-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/wfg/linux: writeback: Fix data corruption on NFS

Linus Torvalds committed 12 years ago

Commit 70b23ce2 parents a9bdddb f9b0e051 file · +9 −6Browse files

Unified · Split

fs/fs-writeback.c+9−6
@@ -516,13 +516,16 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb, · 515 unmodified lines
516516 }
517517 WARN_ON(inode->i_state & I_SYNC);
518518 /*
519− * Skip inode if it is clean. We don't want to mess with writeback
520− * lists in this function since flusher thread may be doing for example
521− * sync in parallel and if we move the inode, it could get skipped. So
522− * here we make sure inode is on some writeback list and leave it there
523− * unless we have completely cleaned the inode.
519+ * Skip inode if it is clean and we have no outstanding writeback in
520+ * WB_SYNC_ALL mode. We don't want to mess with writeback lists in this
521+ * function since flusher thread may be doing for example sync in
522+ * parallel and if we move the inode, it could get skipped. So here we
523+ * make sure inode is on some writeback list and leave it there unless
524+ * we have completely cleaned the inode.
524525 */
525− if (!(inode->i_state & I_DIRTY))
526+ if (!(inode->i_state & I_DIRTY) &&
527+ (wbc->sync_mode != WB_SYNC_ALL ||
528+ !mapping_tagged(inode->i_mapping, PAGECACHE_TAG_WRITEBACK)))
526529 goto out;
527530 inode->i_state |= I_SYNC;
528531 spin_unlock(&inode->i_lock);