Received: by 10.192.165.148 with SMTP id m20csp3439983imm; Mon, 23 Apr 2018 06:40:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx49nVFxKbfmTDsokXS71iD9uMDT3uPA97H67u5Y2b827gN3F4JdhvYG626D4YDuqucq+yHEr X-Received: by 2002:a17:902:3181:: with SMTP id x1-v6mr21078437plb.198.1524490842038; Mon, 23 Apr 2018 06:40:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524490841; cv=none; d=google.com; s=arc-20160816; b=f93LNfh8Ly2kTPqTcTaKCk4o262vsvdkn7xsLGOKPNqPJkiXM1CV9iYRtygClAVRNV CnM9BXKuSFuxO7w3SqUc1bShKhMTtOMJAbgCBx8egMu9q+dDRsn7WIiobmUtJWIc7es7 0/wFVT8qUKjiY9fdzD5HKMUcjywzDgVZVALQpMXUcq4mzc3vgXQ5nOEykCbPe6Ku8H+b KIOP+zWfeDwmof296V4SzJWWHlTmExAPoNlER66aGyKv/LprDNXxi0qPtBXDGbxmooNt sUac9kFyqGMKMMh1dD3R4/vBu4jix7KRsjKPzbCDf2hEXsAeePXqOkOXYu0PT55GF+vz fnFw== 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=oWeFTcDQ81XFDnL9JorQujsFRX7+uNT+PnQdPPKn/E8=; b=GMvV3eOE+79CW8Sq5hPopMoU/9gMT1epVMYs6D+V1ZVxddX1kTbpPjgEvfve4o56fV KP7nsPArxnAu7wwiCJv2HDzAa3EvPVj7MYvDuamOoHsAutdhGajtZsNl6FMRlraYDBT7 3kiP23ySekOpGzQ8WHZBY+a+Fm7BLpEE6Z7FhB53+54sPN9wSAwHIynLCdb6weZOP/9S F++w+rJ79VIMyZextnAi/dL59XUfP9ZLk4VvRXSgePsW1FL0eb4hAW/+hu4WDSaXLj2t 2HdQn98ov4KfeNuGQuQGjCuUtjNbBbk4sOIztdJA/2myCahmg+0JRE1jOrof52tkVhmp QJag== 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 r4si9446552pgt.7.2018.04.23.06.39.57; Mon, 23 Apr 2018 06:40:41 -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 S1755299AbeDWNgV (ORCPT + 99 others); Mon, 23 Apr 2018 09:36:21 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33766 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755152AbeDWNgS (ORCPT ); Mon, 23 Apr 2018 09:36:18 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0536D81A88B6; Mon, 23 Apr 2018 13:36:18 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id E95082023227; Mon, 23 Apr 2018 13:36:17 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id A18D2220267; Mon, 23 Apr 2018 09:36:17 -0400 (EDT) Date: Mon, 23 Apr 2018 09:36:17 -0400 From: Vivek Goyal To: Miklos Szeredi Cc: linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 13/35] ovl: readd fsync Message-ID: <20180423133617.GB2794@redhat.com> References: <20180412150826.20988-1-mszeredi@redhat.com> <20180412150826.20988-14-mszeredi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180412150826.20988-14-mszeredi@redhat.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 23 Apr 2018 13:36:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 23 Apr 2018 13:36:18 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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 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. Vivek > + > + fdput(real); > + > + return ret; > +} > + > const struct file_operations ovl_file_operations = { > .open = ovl_open, > .release = ovl_release, > .llseek = ovl_llseek, > .read_iter = ovl_read_iter, > .write_iter = ovl_write_iter, > + .fsync = ovl_fsync, > }; > -- > 2.14.3 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html