Received: by 10.192.165.148 with SMTP id m20csp3441235imm; Mon, 23 Apr 2018 06:41:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx49KZJyj8WUtsz46kpXzm0SEFztu+xn1yAwFA8AKWVlSFqQBo7aPEuFvfE/ZOgAi8XY+J6Oh X-Received: by 2002:a17:902:6c4b:: with SMTP id h11-v6mr21514806pln.33.1524490913617; Mon, 23 Apr 2018 06:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524490913; cv=none; d=google.com; s=arc-20160816; b=FPKb6Rww434YfriseuJeCD16Kg6tjldDBBgQhVdfmfZa7GlYeNBoHtd99aByvomscA n5Hz9krHwC66nAsRZhFhT3injpY7vLZ3A10SzSuCfTmD0hxCc4E9ow084AGomoI1a6HP 305ZulnxekPjwoMFzpgLI/UpKdfXW+O8qrLNV2erOBoOyvS29OveGJ/lwS9NKy6tyg1D Ihvzi9sn28cVYKZ2DOiTEnDeh6G6g+f93jwyywCW5iG6YBlwXiIzXxvz5CUiz/LfyH3+ wwT1yMJBnJOMvs+67jUgavvwZ1l0sDnrqrEVFCYkfyN4688FnhJT6RSOzer5LfnUo6fG AlmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=hSeqjIDrTddb5Ynh6WlnEIGmPkuJjLSJhGJZNYDqw38=; b=a3mhajijy7NH8dTlrJrHptPpfJs9wuVKWB6qNb9KSxfi/PZcILfQgYL1FhEW/SmToJ pcCajRic9BHZzeVUx7haE+ypom3JcS5dkvqGCjMNb1GFjfn/xoKNF5VUVVuVtHFRPBpw 4BxXMms47X/5xnd4AbGb0AmUCrM0103o7KPIgwpYArVxFnpHxMMfoVIn7TfmwIh8mzvu BjurYBPIUEcDjyb60m8v1JPdY9KECYcSwp7EENslnJj9T8yHtMfHY4351DlgqTBzOMah B/kIk3J++Xjtsrg9O+Wq8ShVwr93ExTh+lQVP5b9DjiXSTa1nCqONzEni7h5ppmDYAgA sU0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=eyGr+bP/; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si11431656pfm.106.2018.04.23.06.41.38; Mon, 23 Apr 2018 06:41:53 -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; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=eyGr+bP/; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755333AbeDWNjs (ORCPT + 99 others); Mon, 23 Apr 2018 09:39:48 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:45844 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755176AbeDWNjq (ORCPT ); Mon, 23 Apr 2018 09:39:46 -0400 Received: by mail-oi0-f67.google.com with SMTP id j10-v6so14265651oii.12 for ; Mon, 23 Apr 2018 06:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=hSeqjIDrTddb5Ynh6WlnEIGmPkuJjLSJhGJZNYDqw38=; b=eyGr+bP/ghgD/gox6FWf4GD8t43iVel+2NJQBj0zNIz/iTWfnmf6j4BNd+wX+SC9M8 Gl/h6BP6fOJB6kK1+oGwAQyubF2lhOOypgpnk+V8RQKuVjUj8vFS0EPYbZ0MM/IGqYT+ sLhCmvIGlt6hcHFeOyp1UyQJKUd9Pa6fjv3NM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=hSeqjIDrTddb5Ynh6WlnEIGmPkuJjLSJhGJZNYDqw38=; b=rig55eLZ+WIblNcc9HY6RIbyE/d+4g0ZdO1jhXAHrR4504TIcXKyl0rUzQxWF8qqEj kCSzdMuYXIrA6/iHif/vTYDekAeVeTXLj4qrXg2r30XEhjwGQyEazNJgP3wALmuowGmU EF0twyFBo3cAqcPitD5Ra5BO62D8YAQNxU4NJ3baQ12o+Mm4XYOJ9ZcQoNEv5tEQbISY +l6dKGocjrYMgo1FL34eHViYoUEcx1BGgsA6AsZv9j00XkM+xkW1GGIwktrzdESDa96p Z4vct4MsohGpnf7HlO6mkWbj3rVr8qfs/F0QOCy4NAAxfxRlXuIMJ0iZL6Hql0whN1yf GZdQ== X-Gm-Message-State: ALQs6tCFMt5AjHe50vVcvqo63CAopkxzYhjTT64dpi9+QlO329t+5Rzs GykPj8FHBNxe0OeEocYv0D33k9V5R2Z3sB/uYsFTqQ== X-Received: by 2002:aca:a610:: with SMTP id p16-v6mr12140971oie.149.1524490785601; Mon, 23 Apr 2018 06:39:45 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:5303:0:0:0:0:0 with HTTP; Mon, 23 Apr 2018 06:39:45 -0700 (PDT) X-Originating-IP: [176.63.54.97] In-Reply-To: <20180423133617.GB2794@redhat.com> References: <20180412150826.20988-1-mszeredi@redhat.com> <20180412150826.20988-14-mszeredi@redhat.com> <20180423133617.GB2794@redhat.com> From: Miklos Szeredi Date: Mon, 23 Apr 2018 15:39:45 +0200 Message-ID: Subject: Re: [RFC PATCH 13/35] ovl: readd fsync To: Vivek Goyal Cc: Miklos Szeredi , overlayfs , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 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? Thanks, Miklos