From mboxrd@z Thu Jan 1 00:00:00 1970 From: npiggin@suse.de Subject: [patch 2/8] mm: write_cache_pages AOP_WRITEPAGE_ACTIVATE fix Date: Fri, 10 Oct 2008 02:50:41 +1100 Message-ID: <20081009174822.298327659@suse.de> References: <20081009155039.139856823@suse.de> Cc: Mikulas Patocka , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org To: Andrew Morton Return-path: Received: from ns1.suse.de ([195.135.220.2]:46827 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751295AbYJIH6m (ORCPT ); Thu, 9 Oct 2008 03:58:42 -0400 Content-Disposition: inline; filename=mm-wcp-writepage-activate-fix.patch Sender: linux-fsdevel-owner@vger.kernel.org List-ID: In write_cache_pages, if AOP_WRITEPAGE_ACTIVATE is returned, the filesystem is calling on us to drop the page lock and retry, however the existing code would just skip that page regardless of whether or not it was a data interity operation. Change this to always retry such a result. This is a data interity bug. Signed-off-by: Nick Piggin --- Index: linux-2.6/mm/page-writeback.c =================================================================== --- linux-2.6.orig/mm/page-writeback.c +++ linux-2.6/mm/page-writeback.c @@ -916,6 +916,7 @@ retry: * swizzled back from swapper_space to tmpfs file * mapping */ +again: lock_page(page); if (unlikely(page->mapping != mapping)) { @@ -940,10 +941,11 @@ retry: } ret = (*writepage)(page, wbc, data); - if (unlikely(ret == AOP_WRITEPAGE_ACTIVATE)) { + /* Must retry the write */ unlock_page(page); ret = 0; + goto again; } if (ret || (--(wbc->nr_to_write) <= 0)) done = 1; --