Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4445200pxb; Mon, 21 Feb 2022 21:51:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKqkO64Y4bbNktVHBps3AAzxkzrwbJxrUIukgAKb/g3FezEmANla3Edc0DQzeb4VIW4QpT X-Received: by 2002:a17:903:3093:b0:14f:b5f7:45aa with SMTP id u19-20020a170903309300b0014fb5f745aamr8418523plc.121.1645509079380; Mon, 21 Feb 2022 21:51:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645509079; cv=none; d=google.com; s=arc-20160816; b=QKRCPj+7n8njoVtp0a1P1Du0I+0yfDE/HRAns7plaS4REBeqO0T9d12MIBkB5wLPXg p06qQGH0wy/VNxelrad+FquDAzNfqr7ZNYvkY8V9H8LOHQcNT8EXKuQj26AGuK4zzzMD p8SE5vaH3KA3JUxFt395D+yDwvZO2bmKb+WlfRj+CdO+CbA7wzEjDRm247x5pSTPWvwU /glC+oTwoRGweZ0cq9bMKidxThSGhK68gF6fbMY8UFdis8268BpPnPTrDcC4mu6jantG Gr6YO1sAuoonummPBPAH+2cCCyIzxRA2IcEh3DRuaogG856eODHmNyEip2iHOSE97N11 c+Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7mbWn+3Rp8xIT1pvsEY7naSWPK183MNG/0QztvV1A04=; b=q4rZuPzYN2t2RfR5kmwbQ0kddx0V98Arv92p+6OtX0TegAffPFNl03zCJN3L69aojn b3eahiiwnzAc4wLw66GMN3B6naxr48zJ3KTijvB4szrPxA62u7m4+kutxq4rXHKdHfiz 2Lg99cjORdxRBDRNZiJ0IGSOhuF3Po9XN8sdg7ysVRY8Xv+fB+ym9Ihz4mVBhXY/sJlv kjSORRQBwg9ofXodlUK724d3831OLFfLBXLAFG0W347AYDyk0L17S4qTk1Zzzztr92xQ KXqcet92vox+/Czk5EVhBPI2+I/UQvPf45/XyH0qdWnToZ1gUBMGdGU+nSH1iBigRLZy w8LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rSOPhYZo; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k10si12137631pfc.213.2022.02.21.21.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:51:19 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rSOPhYZo; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A300FA0BC1; Mon, 21 Feb 2022 21:14:47 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351447AbiBUJus (ORCPT + 99 others); Mon, 21 Feb 2022 04:50:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351665AbiBUJqY (ORCPT ); Mon, 21 Feb 2022 04:46:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 374443FD91; Mon, 21 Feb 2022 01:18:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B9EB960F51; Mon, 21 Feb 2022 09:18:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D1B0C340F5; Mon, 21 Feb 2022 09:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645435117; bh=TXTiTY4Ys45f9GxVHtZc35Xx0/63xfUWdOIcjcLwCA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rSOPhYZouQNsJtY7gL+uCOc3sFaeo5NE4pjKuR/aoYXAzzB3MawRiqCwKVGJL0ccK Mv/a6d49e5rsGCXEwnVYNjmpHLU2dWxF1js4P1adFLtsI/Z+5oxphPTCdFWTPy9abW j01a+SdDUyFkE29GZzTouk1wtDX+9RhSvAJW6JJ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Jan Kara , Christoph Hellwig , Christian Brauner , Sasha Levin Subject: [PATCH 5.16 051/227] vfs: make sync_filesystem return errors from ->sync_fs Date: Mon, 21 Feb 2022 09:47:50 +0100 Message-Id: <20220221084936.569402281@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084934.836145070@linuxfoundation.org> References: <20220221084934.836145070@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Darrick J. Wong [ Upstream commit 5679897eb104cec9e99609c3f045a0c20603da4c ] Strangely, sync_filesystem ignores the return code from the ->sync_fs call, which means that syscalls like syncfs(2) never see the error. This doesn't seem right, so fix that. Signed-off-by: Darrick J. Wong Reviewed-by: Jan Kara Reviewed-by: Christoph Hellwig Acked-by: Christian Brauner Signed-off-by: Sasha Levin --- fs/sync.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/fs/sync.c b/fs/sync.c index 3ce8e2137f310..c7690016453e4 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -29,7 +29,7 @@ */ int sync_filesystem(struct super_block *sb) { - int ret; + int ret = 0; /* * We need to be protected against the filesystem going from @@ -52,15 +52,21 @@ int sync_filesystem(struct super_block *sb) * at a time. */ writeback_inodes_sb(sb, WB_REASON_SYNC); - if (sb->s_op->sync_fs) - sb->s_op->sync_fs(sb, 0); + if (sb->s_op->sync_fs) { + ret = sb->s_op->sync_fs(sb, 0); + if (ret) + return ret; + } ret = sync_blockdev_nowait(sb->s_bdev); - if (ret < 0) + if (ret) return ret; sync_inodes_sb(sb); - if (sb->s_op->sync_fs) - sb->s_op->sync_fs(sb, 1); + if (sb->s_op->sync_fs) { + ret = sb->s_op->sync_fs(sb, 1); + if (ret) + return ret; + } return sync_blockdev(sb->s_bdev); } EXPORT_SYMBOL(sync_filesystem); -- 2.34.1