Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1304411pxu; Thu, 17 Dec 2020 07:04:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDeDSaotmKTTjaq9EA1If8w6nKZIeuvGP0vO6Mz1/vlN5hTIgD1qTSALOQrKsZ1HnxGu2J X-Received: by 2002:a17:906:fa12:: with SMTP id lo18mr36299971ejb.354.1608217465688; Thu, 17 Dec 2020 07:04:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608217465; cv=none; d=google.com; s=arc-20160816; b=M3YFKtNDriSTNzHE8aP1vQzwpT3W7Z8WoC5tUq1YsqkTQ39sHxaC7WNsAzmAReE0+t FcwmERHVdmGhdpU/XsO3v5mYbDunrRPdeGxXRjFqXzsLueH6EgK5EOIeVnhPePyX1Yr4 rwPmZCItkRDJ9ZXw6I5D/2MfT2EWK+rRquASTxdiX1OKvUYL+R2g/o7lCg6J4RtC6spL +diL+O4ceGmz+EqqRjqAUQI6jcJqKnVN9RTuPdBbZae7YaWHAgWLC5R0tirgEPZofoz5 7ZWbNgi6jDqiZBUBq4AnRuxDwNqNBkjSGzaMsIEJ7jrndjQhZD3OrffLcLzXoRatvFd0 J32w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZrUawnXtjtGun/f0FYscqL21akIuvo9XyiO75S1bCyI=; b=OGwDpRAvLC2zAfgA/Xrert5VnR9RAuezPfAopdrap5+YViFhj/K4GyztADi5iYWIKx AAnFSAuBJXuNR3XvgEKxjIT+pKAzI/nttbbj1yUCJgcDnuz7GXPbZqUtYxLTS8rPlKfi +GcoXGsYvnYhORY9r5rXcEqnJiGHCeyuZbJpv7C4Zewl0zza+ZUJkgHlukLiuKDb3hGy 54kV6GiYpNMROc5u5ODSKaZ2lAjPYCL9r5kWeD7CJ8/4c5Z1yOBWX21hfajj2wJjnAhB h8mjNtW1aZ4yBMs6wkC8odwsPLIu1+hh5nuvrfZOVSPiLSK0OI2K+jSOKnej41tND9q0 ix0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e8n13cGw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z4si2669088ejw.380.2020.12.17.07.04.02; Thu, 17 Dec 2020 07:04:25 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e8n13cGw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729012AbgLQPCG (ORCPT + 99 others); Thu, 17 Dec 2020 10:02:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:58352 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727769AbgLQPCG (ORCPT ); Thu, 17 Dec 2020 10:02:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608217239; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZrUawnXtjtGun/f0FYscqL21akIuvo9XyiO75S1bCyI=; b=e8n13cGwGBbXy2eCVCdZfQbKWhBjzn53OKy/YCie2PY4lyy7qnUGz6qR2nN8hI7/myLUZl hGg+MkzmahQyQJu5sTol+HKudtjFHfQHLAqKIksomDd0LWnth1sRarKlPYEnbzQNF5gmx3 KDRqB8V5IQsWH//3Of5ACgkhLYFOht0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-596-OuBLCoJNOXS57Vl_F-3VSQ-1; Thu, 17 Dec 2020 10:00:35 -0500 X-MC-Unique: OuBLCoJNOXS57Vl_F-3VSQ-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3C6F7800D53; Thu, 17 Dec 2020 15:00:31 +0000 (UTC) Received: from horse.redhat.com (ovpn-112-107.rdu2.redhat.com [10.10.112.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id E69035D9D7; Thu, 17 Dec 2020 15:00:29 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 78420220BCF; Thu, 17 Dec 2020 10:00:29 -0500 (EST) Date: Thu, 17 Dec 2020 10:00:29 -0500 From: Vivek Goyal To: Al Viro 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: <20201217150029.GA3630@redhat.com> References: <20201216233149.39025-1-vgoyal@redhat.com> <20201216233149.39025-2-vgoyal@redhat.com> <20201217004935.GN3579531@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201217004935.GN3579531@ZenIV.linux.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 17, 2020 at 12:49:35AM +0000, Al Viro wrote: > [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. I posted V1 patch to do exactly above. In __sync_filesystem(), capture return code from ->sync_fs() but continue to call __sync_blockdev() and and return error code from ->sync_fs() if there is one otherwise return error code from __sync_blockdev(). https://lore.kernel.org/linux-fsdevel/20201216143802.GA10550@redhat.com/ Thanks Vivek > No idea about quota situation. >