From patchwork Wed Apr 12 12:06:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9677299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A8B2060325 for ; Wed, 12 Apr 2017 12:08:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BBB328663 for ; Wed, 12 Apr 2017 12:08:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9083A28666; Wed, 12 Apr 2017 12:08:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5011528663 for ; Wed, 12 Apr 2017 12:08:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753831AbdDLMGd (ORCPT ); Wed, 12 Apr 2017 08:06:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36130 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753727AbdDLMG0 (ORCPT ); Wed, 12 Apr 2017 08:06:26 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0834264D8F; Wed, 12 Apr 2017 12:06:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0834264D8F Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jlayton@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0834264D8F Received: from ceres.poochiereds.net (ovpn-120-205.rdu2.redhat.com [10.10.120.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id 431527B555; Wed, 12 Apr 2017 12:06:20 +0000 (UTC) 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 04/17] ext2: don't test/clear AS_EIO flag Date: Wed, 12 Apr 2017 08:06:01 -0400 Message-Id: <20170412120614.6111-5-jlayton@redhat.com> In-Reply-To: <20170412120614.6111-1-jlayton@redhat.com> References: <20170412120614.6111-1-jlayton@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 12 Apr 2017 12:06:21 +0000 (UTC) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ext2 does a test+clear of AS_EIO flag. With the new error reporting infrastructure, we don't need to clear anything. Sample the file's current error code, and after writeback just report whether any errors have been seen since then. Signed-off-by: Jeff Layton --- fs/ext2/file.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/ext2/file.c b/fs/ext2/file.c index b21891a6bfca..0ca77d337c94 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c @@ -177,7 +177,12 @@ int ext2_fsync(struct file *file, loff_t start, loff_t end, int datasync) struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping; ret = generic_file_fsync(file, start, end, datasync); - if (ret == -EIO || test_and_clear_bit(AS_EIO, &mapping->flags)) { + if (ret == -EIO) + ret = -EIO; + else + ret = filemap_check_errors(mapping); + + if (ret) { /* We don't really know where the IO error happened... */ ext2_error(sb, __func__, "detected IO error when writing metadata buffers");