Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753955AbdCHQzH (ORCPT ); Wed, 8 Mar 2017 11:55:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59900 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbdCHQzB (ORCPT ); Wed, 8 Mar 2017 11:55:01 -0500 From: Jeff Layton To: viro@zeniv.linux.org.uk, akpm@linux-foundation.org Cc: konishi.ryusuke@lab.ntt.co.jp, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-nilfs@vger.kernel.org, ross.zwisler@linux.intel.com, jack@suse.cz, neilb@suse.com, openosd@gmail.com, adilger@dilger.ca, James.Bottomley@HansenPartnership.com Subject: [PATCH v2 6/9] mm: set mapping error when launder_pages fails Date: Wed, 8 Mar 2017 11:29:31 -0500 Message-Id: <20170308162934.21989-7-jlayton@redhat.com> In-Reply-To: <20170308162934.21989-1-jlayton@redhat.com> References: <20170308162934.21989-1-jlayton@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 08 Mar 2017 16:30:21 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 914 Lines: 32 If launder_page fails, then we hit a problem writing back some inode data. Ensure that we communicate that fact in a subsequent fsync since another task could still have it open for write. Signed-off-by: Jeff Layton --- mm/truncate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mm/truncate.c b/mm/truncate.c index 6263affdef88..29ae420a5bf9 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -594,11 +594,15 @@ invalidate_complete_page2(struct address_space *mapping, struct page *page) static int do_launder_page(struct address_space *mapping, struct page *page) { + int ret; + if (!PageDirty(page)) return 0; if (page->mapping != mapping || mapping->a_ops->launder_page == NULL) return 0; - return mapping->a_ops->launder_page(page); + ret = mapping->a_ops->launder_page(page); + mapping_set_error(mapping, ret); + return ret; } /** -- 2.9.3