Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1111804imm; Wed, 1 Aug 2018 10:22:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcQi/3If6QGHs1TQ94h8NEuRLDk6LM9itKVu4dl7zxwzyA5Wj+k869YhykDtpjOgtT1/TCu X-Received: by 2002:a17:902:1ab:: with SMTP id b40-v6mr24935589plb.55.1533144134607; Wed, 01 Aug 2018 10:22:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144134; cv=none; d=google.com; s=arc-20160816; b=iza2ZrcsPJLE4OczRI7IcDWqIvddNrUQkA6IgP8T+2TKSBXyhazX1nfNC9BLonTNtG yR0ITbQuRdTuJ3eQsy+AiN/zGkU9/y6+YmxmUwJ8uGT4OGKjk5MRxzbmAmKNeYO8hf83 NVszHOA7NrjR+qVbIBLI+EqgEsHMQ1q237OY0zIcB2axGqI35UvuN6dggOaC3CLFltZJ SWbUCEfOYLT7gHN7aRuGWT1loiaCzF2NPZrUdc+iisG1W/dNLix1laEPHjWTmx02f1Zv csxa7A3G4Cf7+wZdhYNtgDd+59uxuA7R9H73dH7qXne83SXv5mGHhtsvTJBVUaOkR7px 43Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=wb10ook25ZTEVgkLMGZYpu5qezVeSeURpIFQ+qapdnU=; b=poONgGRzYHn9AyC7Cf5cGfr0Ldbkc+uOpv8v/rr3WBgosNZzmZNBvUMYoncoB03mvs QOyyOBSQypOP2GKDwkA1xQkcHwXWdj0bFBGGIVxxK1yxQIW5L5OOszOGKYSBbmDafVPA eejsvIpq8ixZyMOf9YnswY2lplBbAxO6TYXGhM/yFh7d40iGzgaiwieKeOq8/fnCRxI6 Qa8WoQnNoXd/muXN7PRkt8y5OXiND4ifq7nCWjWHv7sCXl2YgEHgHK73kllwf/9DxE8F SvSpNmicGbDXub1eegMFir2lwrTSEWkY/odMgrUF/s6DJg0yvXBWzCxoIAJdLHXqc7Xw EgNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 144-v6si14342354pfw.95.2018.08.01.10.21.59; Wed, 01 Aug 2018 10:22:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405348AbeHATG4 (ORCPT + 99 others); Wed, 1 Aug 2018 15:06:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49084 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403967AbeHATGz (ORCPT ); Wed, 1 Aug 2018 15:06:55 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A3A75D1F; Wed, 1 Aug 2018 17:20:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaegeuk Kim , Sasha Levin Subject: [PATCH 4.14 169/246] f2fs: avoid fsync() failure caused by EAGAIN in writepage() Date: Wed, 1 Aug 2018 18:51:19 +0200 Message-Id: <20180801165019.820632860@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jaegeuk Kim [ Upstream commit 5b19d284f5195a925dd015a6397bfce184097378 ] pageout() in MM traslates EAGAIN, so calls handle_write_error() -> mapping_set_error() -> set_bit(AS_EIO, ...). file_write_and_wait_range() will see EIO error, which is critical to return value of fsync() followed by atomic_write failure to user. Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/data.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1601,7 +1601,13 @@ out: redirty_out: redirty_page_for_writepage(wbc, page); - if (!err) + /* + * pageout() in MM traslates EAGAIN, so calls handle_write_error() + * -> mapping_set_error() -> set_bit(AS_EIO, ...). + * file_write_and_wait_range() will see EIO error, which is critical + * to return value of fsync() followed by atomic_write failure to user. + */ + if (!err || wbc->for_reclaim) return AOP_WRITEPAGE_ACTIVATE; unlock_page(page); return err;