Received: by 10.192.165.148 with SMTP id m20csp3455425imm; Mon, 23 Apr 2018 06:56:27 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+DzV9JyKSlTxdEn2F74PSh1pobaGJ1Gw8pwsG1Y7FNNUM6ZNx/kQ9l+s7eCWdvQQ6QKkrh X-Received: by 10.98.35.11 with SMTP id j11mr10687239pfj.177.1524491787265; Mon, 23 Apr 2018 06:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524491787; cv=none; d=google.com; s=arc-20160816; b=cgamVZB/46rKdICR9wLkoJbsb2gy7HMDQLl66EQ7neTJ3UQ6NXPFoEGyIp2+W3psbN GkuEdN94oCsPq4zCVKLeYrZKJ3iEAxI++o0mBe0J67cIHJeE+3cix7j3vMQsw3RFsMgK uxy3fRyfJg4Oe+bkFaQ2y5Xq7U1Db5RYRc4zPA5pX399rDbEHo7tvzsZ/h+XnAw8JPmr w1baUkn/ieSON8vLFEkx23+PHh6TyUHStoL8Xh4x3FBm20B79ji/8xSPyrznOlf2tghT PanLmBvVchwAeNmh19gdM7rZVQOBf9fK21P6QjyQ2OMOR5Net31PQG6Ke04wVrwg4jU2 DErQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=dbrTKvWMPxlPPq94PoH2sCzZta4XBupFfUckdDPUfWs=; b=BMSqwRpVZup+0lz+lLwORR8Ez58/x4RSuDbDsFmoYqrlaQf2aE7NAt1w+wh9HSfJO/ kDc/xVJI0nOsrT/IHBgJWnrfCQg5c8jXYf3rKzY0xKrMrHNfZCE4D1u6Wu3h9cUt0ojS UQuJVNRo6nc+/kf9qtJnKeeA5QEDhFfHUUSrS9kug0tgg9mRZDNcQG5wqyG9UYwZr9mW CnkPGcc+erbqmvrI4quostAfLMM1FW71z/qEVbGitSGMSz0qX5cYUb32jNcjnN6eK4AE ghXewEKxtVnHVO+A1wEXBy3W9Ei81ZWEFU6ypW5eTgTYXr0e559jwkwNkEjHXKsFWNJz 3KPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si9381223pgs.556.2018.04.23.06.56.12; Mon, 23 Apr 2018 06:56:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755450AbeDWNxL (ORCPT + 99 others); Mon, 23 Apr 2018 09:53:11 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44352 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755126AbeDWNxK (ORCPT ); Mon, 23 Apr 2018 09:53:10 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C605C406E971; Mon, 23 Apr 2018 13:53:09 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7ADE883B84; Mon, 23 Apr 2018 13:53:09 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 359BA220267; Mon, 23 Apr 2018 09:53:09 -0400 (EDT) Date: Mon, 23 Apr 2018 09:53:09 -0400 From: Vivek Goyal To: Miklos Szeredi Cc: Miklos Szeredi , overlayfs , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 13/35] ovl: readd fsync Message-ID: <20180423135309.GC2794@redhat.com> References: <20180412150826.20988-1-mszeredi@redhat.com> <20180412150826.20988-14-mszeredi@redhat.com> <20180423133617.GB2794@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 23 Apr 2018 13:53:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 23 Apr 2018 13:53:09 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'vgoyal@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 23, 2018 at 03:39:45PM +0200, Miklos Szeredi wrote: > On Mon, Apr 23, 2018 at 3:36 PM, Vivek Goyal wrote: > > On Thu, Apr 12, 2018 at 05:08:04PM +0200, Miklos Szeredi wrote: > >> Implement stacked fsync(). > >> > >> Signed-off-by: Miklos Szeredi > >> --- > >> fs/overlayfs/file.c | 20 ++++++++++++++++++++ > >> 1 file changed, 20 insertions(+) > >> > >> diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c > >> index b98204c1c19c..4417527667ff 100644 > >> --- a/fs/overlayfs/file.c > >> +++ b/fs/overlayfs/file.c > >> @@ -222,10 +222,30 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) > >> return ret; > >> } > >> > >> +static int ovl_fsync(struct file *file, loff_t start, loff_t end, int datasync) > >> +{ > >> + struct fd real; > >> + const struct cred *old_cred; > >> + int ret; > >> + > >> + ret = ovl_real_file(file, &real); > >> + if (ret) > >> + return ret; > >> + > >> + old_cred = ovl_override_creds(file_inode(file)->i_sb); > >> + ret = vfs_fsync_range(real.file, start, end, datasync); > >> + revert_creds(old_cred); > > > > Can we avoid calling fsync() on real file if it is not upper. Is it worth > > optimizing. > > Not sure it's worth bothering with. If caller of fsync(2) didn't > worry about cost, then why should we? I was thinking more from the point of view of metadata copy up patches. For a metacopy file, I was thinking if I can just issue fsync() on upper file and skip it on lower file. Anyway, I don't have any strong opinion here. Vivek