Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp851175pxu; Wed, 16 Dec 2020 16:52:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0N+lc0qPWjDVahRjZtttHXbRzIuq73c0Ca/8+4DxHyi/3lTS/7NRmYt8hlvG0wDTmTMma X-Received: by 2002:a05:6402:229b:: with SMTP id cw27mr35984217edb.23.1608166349111; Wed, 16 Dec 2020 16:52:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608166349; cv=none; d=google.com; s=arc-20160816; b=s8Tkg3ZpdrdzxLy1mKq4A81JF0G2SB+UZYPxFOELcQ8kuAg+uu/lyQruhaA0UO3BMd BRz7ORl9WSARYv1iGhcIlqN9E2VUmUwfb8Iz8Brh6y2YjwBfMb9bT0xmWQ4C1BZeGs8L om3+McQ2aIaen1ViwU7/q0T9EiebIZaLE0us7qYCVwrIi6qkxd3kUy/0kUk3YzB5S8Se ZCYdjO2mVIXjizlLJfO8LV+eIDdbh4TLuamkoButctx6ndx6IEcDEONeLxzm7Xf7IFcz EincWoedHVU1ACg/EQ8Lm1Q1duTFfAvWNq8Y0UDD3M1EUMMwlmDdqYV5qeZ0bQ+SVqOp G+RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=JELNOhaqgGM5y0i6XIFZMJ1oYX/QKm8xtmExQ0SnhvU=; b=a7Uj3pt3W0fPG3cza4bmWzTKD1oAsQk9srvfLaMVKjlhtxIV6F8QaXe0w88nOse4t5 ctiMfGTuDpmElK/N2yidopB/4vnZBqcPKkDpE/ZdPbncY8KLNpJYeszS1t+v8e1nfn2k yFB6hV/gOHytM8DmHYnj92IcpcJnOCNwpuhbiyAJqdTzFZ8LInjrZRlx+ZZBF+HBkJSK SWQptQ4m3rs1+3w1axZgrC0KfotXmgWkGLSQ8/Qq+WzN+t30WjORYH+uLIb5wTP864Id rhkJn8aiPA4barxmkphuPpJCNOABrwRDcp5dk6iLOCkzUgM1XpHjcQEHA4AI5Pxe8W+b tpeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p20si1603965ejx.41.2020.12.16.16.52.06; Wed, 16 Dec 2020 16:52:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726863AbgLQAuf (ORCPT + 99 others); Wed, 16 Dec 2020 19:50:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725974AbgLQAue (ORCPT ); Wed, 16 Dec 2020 19:50:34 -0500 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71559C061794; Wed, 16 Dec 2020 16:49:54 -0800 (PST) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kphU7-001mxp-VM; Thu, 17 Dec 2020 00:49:36 +0000 Date: Thu, 17 Dec 2020 00:49:35 +0000 From: Al Viro To: Vivek Goyal Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-unionfs@vger.kernel.org, jlayton@kernel.org, amir73il@gmail.com, sargun@sargun.me, miklos@szeredi.hu, willy@infradead.org, jack@suse.cz, neilb@suse.com, Christoph Hellwig Subject: Re: [PATCH 1/3] vfs: add new f_op->syncfs vector Message-ID: <20201217004935.GN3579531@ZenIV.linux.org.uk> References: <20201216233149.39025-1-vgoyal@redhat.com> <20201216233149.39025-2-vgoyal@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201216233149.39025-2-vgoyal@redhat.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Christoph added to Cc...] On Wed, Dec 16, 2020 at 06:31:47PM -0500, Vivek Goyal wrote: > Current implementation of __sync_filesystem() ignores the return code > from ->sync_fs(). I am not sure why that's the case. There must have > been some historical reason for this. > > Ignoring ->sync_fs() return code is problematic for overlayfs where > it can return error if sync_filesystem() on upper super block failed. > That error will simply be lost and sycnfs(overlay_fd), will get > success (despite the fact it failed). > > If we modify existing implementation, there is a concern that it will > lead to user space visible behavior changes and break things. So > instead implement a new file_operations->syncfs() call which will > be called in syncfs() syscall path. Return code from this new > call will be captured. And all the writeback error detection > logic can go in there as well. Only filesystems which implement > this call get affected by this change. Others continue to fallback > to existing mechanism. That smells like a massive source of confusion down the road. I'd just looked through the existing instances; many always return 0, but quite a few sometimes try to return an error: fs/btrfs/super.c:2412: .sync_fs = btrfs_sync_fs, fs/exfat/super.c:204: .sync_fs = exfat_sync_fs, fs/ext4/super.c:1674: .sync_fs = ext4_sync_fs, fs/f2fs/super.c:2480: .sync_fs = f2fs_sync_fs, fs/gfs2/super.c:1600: .sync_fs = gfs2_sync_fs, fs/hfsplus/super.c:368: .sync_fs = hfsplus_sync_fs, fs/nilfs2/super.c:689: .sync_fs = nilfs_sync_fs, fs/ocfs2/super.c:139: .sync_fs = ocfs2_sync_fs, fs/overlayfs/super.c:399: .sync_fs = ovl_sync_fs, fs/ubifs/super.c:2052: .sync_fs = ubifs_sync_fs, is the list of such. There are 4 method callers: dquot_quota_sync(), dquot_disable(), __sync_filesystem() and sync_fs_one_sb(). For sync_fs_one_sb() we want to ignore the return value; for __sync_filesystem() we almost certainly do *not* - it ends with return __sync_blockdev(sb->s_bdev, wait), after all. The question for that one is whether we want __sync_blockdev() called even in case of ->sync_fs() reporting a failure, and I suspect that it's safer to call it anyway and return the first error value we'd got. No idea about quota situation.