Please sign in to comment.
writeback: put unused inodes to LRU after writeback completion
Commit 169ebd9 ("writeback: Avoid iput() from flusher thread") removed iget-iput pair from inode writeback. As a side effect, inodes that are dirty during iput_final() call won't be ever added to inode LRU (iput_final() doesn't add dirty inodes to LRU and later when the inode is cleaned there's noone to add the inode there). Thus inodes are effectively unreclaimable until someone looks them up again. The practical effect of this bug is limited by the fact that inodes are pinned by a dentry for long enough that the inode gets cleaned. But still the bug can have nasty consequences leading up to OOM conditions under certain circumstances. Following can easily reproduce the problem: for (( i = 0; i < 1000; i++ )); do mkdir $i for (( j = 0; j < 1000; j++ )); do touch $i/$j echo 2 > /proc/sys/vm/drop_caches done done then one needs to run 'sync; ls -lR' to make inodes reclaimable again. We fix the issue by inserting unused clean inodes into the LRU after writeback finishes in inode_sync_complete(). Signed-off-by: Jan Kara <firstname.lastname@example.org> Reported-by: OGAWA Hirofumi <email@example.com> Cc: Al Viro <firstname.lastname@example.org> Cc: OGAWA Hirofumi <email@example.com> Cc: Wu Fengguang <firstname.lastname@example.org> Cc: Dave Chinner <email@example.com> Cc: <firstname.lastname@example.org> [3.5+] Signed-off-by: Andrew Morton <email@example.com> Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
- Loading branch information...
Showing with 17 additions and 2 deletions.