]> err.no Git - linux-2.6/blobdiff - fs/buffer.c
[PATCH] knfsd: Fix type mismatch with filldir_t used by nfsd
[linux-2.6] / fs / buffer.c
index 3b116078b4c399211875623092de6eec139d4c15..460f1c43238e1f9eb20bd0ae50ed046305ceb384 100644 (file)
@@ -2834,7 +2834,7 @@ int try_to_free_buffers(struct page *page)
        int ret = 0;
 
        BUG_ON(!PageLocked(page));
-       if (PageDirty(page) || PageWriteback(page))
+       if (PageWriteback(page))
                return 0;
 
        if (mapping == NULL) {          /* can this still happen? */
@@ -2845,6 +2845,19 @@ int try_to_free_buffers(struct page *page)
        spin_lock(&mapping->private_lock);
        ret = drop_buffers(page, &buffers_to_free);
        spin_unlock(&mapping->private_lock);
+
+       /*
+        * If the filesystem writes its buffers by hand (eg ext3)
+        * then we can have clean buffers against a dirty page.  We
+        * clean the page here; otherwise the VM will never notice
+        * that the filesystem did any IO at all.
+        *
+        * Also, during truncate, discard_buffer will have marked all
+        * the page's buffers clean.  We discover that here and clean
+        * the page also.
+        */
+       if (ret)
+               cancel_dirty_page(page, PAGE_CACHE_SIZE);
 out:
        if (buffers_to_free) {
                struct buffer_head *bh = buffers_to_free;