From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by kanga.kvack.org (Postfix) with ESMTP id AE3316B02FD for ; Thu, 29 Jun 2017 09:20:07 -0400 (EDT) Received: by mail-oi0-f70.google.com with SMTP id 191so21739974oii.4 for ; Thu, 29 Jun 2017 06:20:07 -0700 (PDT) Received: from mail.kernel.org (mail.kernel.org. [198.145.29.99]) by mx.google.com with ESMTPS id e194si3613944oib.35.2017.06.29.06.20.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jun 2017 06:20:06 -0700 (PDT) From: jlayton@kernel.org Subject: [PATCH v8 03/18] fs: check for writeback errors after syncing out buffers in generic_file_fsync Date: Thu, 29 Jun 2017 09:19:39 -0400 Message-Id: <20170629131954.28733-4-jlayton@kernel.org> In-Reply-To: <20170629131954.28733-1-jlayton@kernel.org> References: <20170629131954.28733-1-jlayton@kernel.org> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton , Al Viro , Jan Kara , tytso@mit.edu, axboe@kernel.dk, mawilcox@microsoft.com, ross.zwisler@linux.intel.com, corbet@lwn.net, Chris Mason , Josef Bacik , David Sterba , "Darrick J . Wong" Cc: Carlos Maiolino , Eryu Guan , David Howells , Christoph Hellwig , Liu Bo , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-block@vger.kernel.org From: Jeff Layton ext2 currently does a test+clear of the AS_EIO flag, which is is problematic for some coming changes. What we really need to do instead is call filemap_check_errors in __generic_file_fsync after syncing out the buffers. That will be sufficient for this case, and help other callers detect these errors properly as well. With that, we don't need to twiddle it in ext2. Suggested-by: Jan Kara Signed-off-by: Jeff Layton Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara Reviewed-by: Matthew Wilcox --- fs/ext2/file.c | 5 +---- fs/libfs.c | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/ext2/file.c b/fs/ext2/file.c index b21891a6bfca..d34d32bdc944 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c @@ -174,15 +174,12 @@ int ext2_fsync(struct file *file, loff_t start, loff_t end, int datasync) { int ret; struct super_block *sb = file->f_mapping->host->i_sb; - 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) /* We don't really know where the IO error happened... */ ext2_error(sb, __func__, "detected IO error when writing metadata buffers"); - ret = -EIO; - } return ret; } diff --git a/fs/libfs.c b/fs/libfs.c index a04395334bb1..1dec90819366 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -991,7 +991,8 @@ int __generic_file_fsync(struct file *file, loff_t start, loff_t end, out: inode_unlock(inode); - return ret; + err = filemap_check_errors(inode->i_mapping); + return ret ? ret : err; } EXPORT_SYMBOL(__generic_file_fsync); -- 2.13.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org