diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/buffer.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 3b116078b4c3..460f1c43238e 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -2834,7 +2834,7 @@ int try_to_free_buffers(struct page *page) | |||
2834 | int ret = 0; | 2834 | int ret = 0; |
2835 | 2835 | ||
2836 | BUG_ON(!PageLocked(page)); | 2836 | BUG_ON(!PageLocked(page)); |
2837 | if (PageDirty(page) || PageWriteback(page)) | 2837 | if (PageWriteback(page)) |
2838 | return 0; | 2838 | return 0; |
2839 | 2839 | ||
2840 | if (mapping == NULL) { /* can this still happen? */ | 2840 | if (mapping == NULL) { /* can this still happen? */ |
@@ -2845,6 +2845,19 @@ int try_to_free_buffers(struct page *page) | |||
2845 | spin_lock(&mapping->private_lock); | 2845 | spin_lock(&mapping->private_lock); |
2846 | ret = drop_buffers(page, &buffers_to_free); | 2846 | ret = drop_buffers(page, &buffers_to_free); |
2847 | spin_unlock(&mapping->private_lock); | 2847 | spin_unlock(&mapping->private_lock); |
2848 | |||
2849 | /* | ||
2850 | * If the filesystem writes its buffers by hand (eg ext3) | ||
2851 | * then we can have clean buffers against a dirty page. We | ||
2852 | * clean the page here; otherwise the VM will never notice | ||
2853 | * that the filesystem did any IO at all. | ||
2854 | * | ||
2855 | * Also, during truncate, discard_buffer will have marked all | ||
2856 | * the page's buffers clean. We discover that here and clean | ||
2857 | * the page also. | ||
2858 | */ | ||
2859 | if (ret) | ||
2860 | cancel_dirty_page(page, PAGE_CACHE_SIZE); | ||
2848 | out: | 2861 | out: |
2849 | if (buffers_to_free) { | 2862 | if (buffers_to_free) { |
2850 | struct buffer_head *bh = buffers_to_free; | 2863 | struct buffer_head *bh = buffers_to_free; |