Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753967AbdDLMGp (ORCPT ); Wed, 12 Apr 2017 08:06:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36994 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753791AbdDLMG3 (ORCPT ); Wed, 12 Apr 2017 08:06:29 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E237BEC0A4 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jlayton@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E237BEC0A4 From: Jeff Layton To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, tytso@mit.edu, jack@suse.cz, willy@infradead.org, neilb@suse.com, viro@zeniv.linux.org.uk Subject: [PATCH v2 12/17] mm: ensure that we set mapping error if writeout() fails Date: Wed, 12 Apr 2017 08:06:09 -0400 Message-Id: <20170412120614.6111-13-jlayton@redhat.com> In-Reply-To: <20170412120614.6111-1-jlayton@redhat.com> References: <20170412120614.6111-1-jlayton@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 12 Apr 2017 12:06:29 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 644 Lines: 27 If writepage fails during a page migration, then we need to ensure that fsync will see it by flagging the mapping. Signed-off-by: Jeff Layton --- mm/migrate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index ed97c2c14fa8..a77b9e769d0b 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -792,7 +792,11 @@ static int writeout(struct address_space *mapping, struct page *page) /* unlocked. Relock */ lock_page(page); - return (rc < 0) ? -EIO : -EAGAIN; + if (rc < 0) { + mapping_set_error(mapping, rc); + return -EIO; + } + return -EAGAIN; } /* -- 2.9.3