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
Unified · Split
| @@ -516,13 +516,16 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb, · 515 unmodified lines | ||
| 516 | 516 | } |
| 517 | 517 | WARN_ON(inode->i_state & I_SYNC); |
| 518 | 518 | /* |
| 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. | |
| 524 | 525 | */ |
| 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))) | |
| 526 | 529 | goto out; |
| 527 | 530 | inode->i_state |= I_SYNC; |
| 528 | 531 | spin_unlock(&inode->i_lock); |