diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2011-04-27 19:05:21 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-03 11:40:44 -0700 |
commit | cfdf7986b6398049c35f8eb6e236d2387ee7ae14 (patch) | |
tree | a0112c267655851db678c130c70fc2e4eb880180 /Documentation/io-mapping.txt | |
parent | ac693061b11c33d5a5c5ec1925de7abd3fcb0971 (diff) |
writeback: update dirtied_when for synced inode to prevent livelock
commit 94c3dcbb0b0cdfd82cedd21705424d8044edc42c upstream.
Explicitly update .dirtied_when on synced inodes, so that they are no
longer considered for writeback in the next round.
It can prevent both of the following livelock schemes:
- while true; do echo data >> f; done
- while true; do touch f; done (in theory)
The exact livelock condition is, during sync(1):
(1) no new inodes are dirtied
(2) an inode being actively dirtied
On (2), the inode will be tagged and synced with .nr_to_write=LONG_MAX.
When finished, it will be redirty_tail()ed because it's still dirty
and (.nr_to_write > 0). redirty_tail() won't update its ->dirtied_when
on condition (1). The sync work will then revisit it on the next
queue_io() and find it eligible again because its old ->dirtied_when
predates the sync work start time.
We'll do more aggressive "keep writeback as long as we wrote something"
logic in wb_writeback(). The "use LONG_MAX .nr_to_write" trick in commit
b9543dac5bbc ("writeback: avoid livelocking WB_SYNC_ALL writeback") will
no longer be enough to stop sync livelock.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'Documentation/io-mapping.txt')
0 files changed, 0 insertions, 0 deletions