From patchwork Fri May 18 12:34:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 10410365 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 F1C3F601F9 for ; Fri, 18 May 2018 12:35:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D983528936 for ; Fri, 18 May 2018 12:35:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC34428956; Fri, 18 May 2018 12:35:41 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 7F5F428936 for ; Fri, 18 May 2018 12:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752195AbeERMfJ (ORCPT ); Fri, 18 May 2018 08:35:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:39524 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752030AbeERMe1 (ORCPT ); Fri, 18 May 2018 08:34:27 -0400 Received: from tleilax.poochiereds.net (cpe-71-70-156-158.nc.res.rr.com [71.70.156.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 816BD20864; Fri, 18 May 2018 12:34:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526646867; bh=cyv4KQzr+RY1dCKa3yyklvmHJlB7MftJC4/UBQahL1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hZvXVlLGe3VeeDJ0XbbvOFQrrQ8MpbS+Xs18YuplhysB3uyDzzveOg+ddQGdwz4Ty GMdiguRrf4DscebVVxEQN0XA1sdzHRVZdrZtSsPFOgeD31RmT8Xeqcx4LZVsihIwU4 d2yvZKAcg3rebJvR0RXcqNp5gxERELClNRPdSUSM= From: Jeff Layton To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: viro@ZenIV.linux.org.uk, willy@infradead.org, andres@anarazel.de Subject: [RFC PATCH 11/11] vfs: have call_sync_fs op report writeback errors when passed a since pointer Date: Fri, 18 May 2018 08:34:15 -0400 Message-Id: <20180518123415.28181-12-jlayton@kernel.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180518123415.28181-1-jlayton@kernel.org> References: <20180518123415.28181-1-jlayton@kernel.org> 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 From: Jeff Layton ...on filesystems that don't define a ->sync_fs operation. Signed-off-by: Jeff Layton --- include/linux/fs.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) NB: I'm not sure this is something we really want to do. It's a bit cavalier and some filesystems might not like it if they are tracking errors in other ways. An alternative here is to add a simple_sync_fs helper that does this and add that to a whole swath of different fs'. diff --git a/include/linux/fs.h b/include/linux/fs.h index fecd29325f36..1ff9d4d119cb 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2505,9 +2505,18 @@ extern const struct file_operations def_chr_fops; static inline int call_sync_fs(struct super_block *sb, int wait, errseq_t *since) { + int ret; + if (sb->s_op->sync_fs) return sb->s_op->sync_fs(sb, wait, since); - return __sync_blockdev(sb->s_bdev, wait); + + ret = __sync_blockdev(sb->s_bdev, wait); + if (since) { + int ret2 = errseq_check_and_advance(&sb->s_wb_err, since); + if (ret == 0) + ret = ret2; + } + return ret; } #ifdef CONFIG_BLOCK