Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5109545pxu; Tue, 22 Dec 2020 08:34:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWXujfVoYC3Xx1vw9wi97h3VCt2Hzqqp7r/LJ76WlcU0ug3YN+RDnpCHYaeozxWrlmOclQ X-Received: by 2002:a17:906:4c4c:: with SMTP id d12mr20687674ejw.307.1608654849667; Tue, 22 Dec 2020 08:34:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608654849; cv=none; d=google.com; s=arc-20160816; b=PAikMnNlOcvzQOFYYGFy/i9HdKDhpIwqGZR7NQiMiauFkhDk8yxwfftu2Tt02IdiGO 1zhyfe05wMKFAGgBoUNdW6jX0Uwa2bK9gLR7lSSbEe6djoHTqY7TAxS54UwSHyAJkVXA VoxGJ9J8epaaUkHZi6sWlLm6vOG6peZonY4An0yoKNRMB9AcSrlSXYoGH1ABTMyJ5mRP RWZIG6J9IOXr7cqgd/13pROBOovLBa0yv+GvW/ab8SO2PEWk6SK1Wte8rTl2bg/VE861 G3cDL1ZV7h9oheucM1L9pA26C523W6wn0D/ZcMwWPrLnyO7tAiWGgHiTPan1IuLWOPJJ UG5A== 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=330C06jTiNvB+VfbF+h/kv6HlOA3dmvIyjYI7GiU5SU=; b=IJ6WTYBdXUndO0ynxY+UzTRPyIm9G8QMPaWFuY2ovrWN/ZSb02t8CnzYcLJGzC36zW FSJWjt26lZroMHGTIcUkGcHff5yNjOdhBFoLHFxO25cNBStjgQ6gvh2Eg1VE6EG5rVTy Rf14zxo2tZE7aLKAUhyVJShecCBeGtb2nYbQr+yCWZ8QEy0HWJwCvSdZqAVSmjKhRNhk pgBt+c7cYDGQONHk4q7X2srDOavvXj/VvisRzpvFHrzlC4jr/iRXBeGIh3kST8IEHXN/ EAPwDqdBquIgEc8pvgwoWxKtg/bJCER+w/s3/Cj49M9bECbaE2peB6+a6CY07MYmFvW0 un+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KkFn8Q88; 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 h8si11861687ejj.587.2020.12.22.08.33.44; Tue, 22 Dec 2020 08:34:09 -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=KkFn8Q88; 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 S1727211AbgLVQc4 (ORCPT + 99 others); Tue, 22 Dec 2020 11:32:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49052 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727883AbgLVQa4 (ORCPT ); Tue, 22 Dec 2020 11:30:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608654570; 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=330C06jTiNvB+VfbF+h/kv6HlOA3dmvIyjYI7GiU5SU=; b=KkFn8Q88CUzrBFCo7bM696or/4dFU6uadNXkEz4RIK1YRFcKuWeeh8I8WNF6o0LGMxIHvh uZhASW7rvPv0llQye9C+fTBjixGHfFq6W3DTF3gfWpTX/lhJDQ1VSNYZ0qi+NfDku9l/4U kwsFd14OhbZ2kx5sPHg4jrZ13JYIHyg= 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-421-E2dyRNjlNGyH2nTvvLTtRg-1; Tue, 22 Dec 2020 11:29:28 -0500 X-MC-Unique: E2dyRNjlNGyH2nTvvLTtRg-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 E919D107ACF5; Tue, 22 Dec 2020 16:29:25 +0000 (UTC) Received: from horse.redhat.com (ovpn-114-207.rdu2.redhat.com [10.10.114.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4F365D9CC; Tue, 22 Dec 2020 16:29:25 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 39A65220BCF; Tue, 22 Dec 2020 11:29:25 -0500 (EST) Date: Tue, 22 Dec 2020 11:29:25 -0500 From: Vivek Goyal To: Matthew Wilcox 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, jack@suse.cz, neilb@suse.com, viro@zeniv.linux.org.uk, hch@lst.de Subject: Re: [PATCH 3/3] overlayfs: Report writeback errors on upper Message-ID: <20201222162925.GC3248@redhat.com> References: <20201221195055.35295-1-vgoyal@redhat.com> <20201221195055.35295-4-vgoyal@redhat.com> <20201222162027.GJ874@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201222162027.GJ874@casper.infradead.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 22, 2020 at 04:20:27PM +0000, Matthew Wilcox wrote: > On Mon, Dec 21, 2020 at 02:50:55PM -0500, Vivek Goyal wrote: > > +static int ovl_errseq_check_advance(struct super_block *sb, struct file *file) > > +{ > > + struct ovl_fs *ofs = sb->s_fs_info; > > + struct super_block *upper_sb; > > + int ret; > > + > > + if (!ovl_upper_mnt(ofs)) > > + return 0; > > + > > + upper_sb = ovl_upper_mnt(ofs)->mnt_sb; > > + > > + if (!errseq_check(&upper_sb->s_wb_err, file->f_sb_err)) > > + return 0; > > + > > + /* Something changed, must use slow path */ > > + spin_lock(&file->f_lock); > > + ret = errseq_check_and_advance(&upper_sb->s_wb_err, &file->f_sb_err); > > + spin_unlock(&file->f_lock); > > Why are you microoptimising syncfs()? Are there really applications which > call syncfs() in a massively parallel manner on the same file descriptor? This is atleast theoritical race. I am not aware which application can trigger this race. So to me it makes sense to fix the race. Jeff Layton also posted a fix for syncfs(). https://lore.kernel.org/linux-fsdevel/20201219134804.20034-1-jlayton@kernel.org/ To me it makes sense to fix the race irrespective of the fact if somebody hit it or not. People end up copying code in other parts of kernel and and they will atleast copy race free code. Vivek