Received: by 10.192.165.156 with SMTP id m28csp761364imm; Fri, 13 Apr 2018 07:24:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/UQWk0HFfNPZdgN7TQ2Act/9g92+Dw1Efkvp+nD6lTTMcajhqyEx4XwkXjGhDpCIxO+Nz+ X-Received: by 2002:a17:902:7249:: with SMTP id c9-v6mr5372288pll.217.1523629476412; Fri, 13 Apr 2018 07:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523629476; cv=none; d=google.com; s=arc-20160816; b=E1D2LoSS1OA8EmzJoA7ax6EU4ga9ZvNvvQBX6pBQhYEEO7ay7bNWr9Uqe30v0f3MKh oZ/R1SqWBKDUd4FrKX3GccnB/GuK+lB3wwa5Y/n/qI/AcryN19NsO/yoI7CaxcKpPE5U FCC4IwsRb/T04r2pLMoVRrJOGSiK2+glhYjo69NlhlcW1sOO3rbG0tKb9P+kyO65epmw OorGMRy9EOurn0lp303LEZnOS9s2b/rHkAX0yc0k2kMeLMxAMC89jcmgKqXeJAjpNAKL 4kUr1wIYvwpRQBVRrgmGXRtC5Yf36MvbtNeCshaAXW2wVBWmELCRzypQ02Oskjc+wcoJ 2AfQ== 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=FjUo64iwz4y5OM1oTdoS1GF6ibQLBgRgonLRbgmqf+Y=; b=v6eulkEQPDLlok96tG4FeNRr4bIIW566cf23YoCQj6EmemCUnPDuF8CCEVpuW9cK9d /SbG+FghPIsC2EhSgNJ+LFAzI1uvyAWvWoSkSD5OmstC/PI4ZuKsmG1usvbW3QQukwsd 4pcHlj+XY+8F8HZr8k4ID2xe7Ui0LxUdMGKR+mhODpa5ONvmg0olTx03LLX4cqtnXFhW zi6Kohmx96Mv8PZDBMXMF7tuSNEosieR1OkHmiEn4tGUwVktFv1pcnRA9Wnc758dHSxO tduBOjqoPaYEHj4FCmpvDUag3/RwB6mQztw84Fbr5w2uwiAUCsHh5xjd9XZtbEsh/3BN ZbeA== 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 f123si4556661pfa.364.2018.04.13.07.24.22; Fri, 13 Apr 2018 07:24:36 -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 S1751828AbeDMOXP (ORCPT + 99 others); Fri, 13 Apr 2018 10:23:15 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40112 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750817AbeDMOXO (ORCPT ); Fri, 13 Apr 2018 10:23:14 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 570FA9BA4B; Fri, 13 Apr 2018 14:23:13 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44B332140625; Fri, 13 Apr 2018 14:23:13 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 1100B22017A; Fri, 13 Apr 2018 10:23:13 -0400 (EDT) Date: Fri, 13 Apr 2018 10:23:13 -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 04/35] ovl: copy up times Message-ID: <20180413142313.GA2706@redhat.com> References: <20180412150826.20988-1-mszeredi@redhat.com> <20180412150826.20988-5-mszeredi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180412150826.20988-5-mszeredi@redhat.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 13 Apr 2018 14:23:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 13 Apr 2018 14:23:13 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.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:07:55PM +0200, Miklos Szeredi wrote: > Copy up mtime and ctime to overlay inode after times in real object are > modified. Be careful not to dirty cachelines when not necessary. > > This is in preparation for moving overlay functionality out of the VFS. > > This patch shouldn't have any observable effect. So there are bunch of operations which will change inode ctime. I had missed this in my metadata only copy up patch series and that would broken atime updates in some cases. Vivek > > Signed-off-by: Miklos Szeredi > --- > fs/overlayfs/dir.c | 5 +++++ > fs/overlayfs/inode.c | 1 + > fs/overlayfs/overlayfs.h | 7 +++++++ > fs/overlayfs/util.c | 19 +++++++++++++++++++ > 4 files changed, 32 insertions(+) > > diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c > index 839709c7803a..cd0fa2363723 100644 > --- a/fs/overlayfs/dir.c > +++ b/fs/overlayfs/dir.c > @@ -507,6 +507,7 @@ static int ovl_create_or_link(struct dentry *dentry, struct inode *inode, > else > err = ovl_create_over_whiteout(dentry, inode, attr, > hardlink); > + ovl_copytimes_with_parent(dentry); > } > out_revert_creds: > revert_creds(old_cred); > @@ -768,6 +769,7 @@ static int ovl_do_remove(struct dentry *dentry, bool is_dir) > drop_nlink(dentry->d_inode); > } > ovl_nlink_end(dentry, locked); > + ovl_copytimes_with_parent(dentry); > out_drop_write: > ovl_drop_write(dentry); > out: > @@ -1079,6 +1081,9 @@ static int ovl_rename(struct inode *olddir, struct dentry *old, > ovl_dentry_version_inc(new->d_parent, ovl_type_origin(old) || > (d_inode(new) && ovl_type_origin(new))); > > + ovl_copytimes_with_parent(old); > + ovl_copytimes_with_parent(new); > + > out_dput: > dput(newdentry); > out_dput_old: > diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c > index 6e3815fb006b..33635106c5f7 100644 > --- a/fs/overlayfs/inode.c > +++ b/fs/overlayfs/inode.c > @@ -303,6 +303,7 @@ int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name, > err = vfs_removexattr(realdentry, name); > } > revert_creds(old_cred); > + ovl_copytimes(d_inode(dentry)); > > out_drop_write: > ovl_drop_write(dentry); > diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h > index e0b7de799f6b..eef720ef0f07 100644 > --- a/fs/overlayfs/overlayfs.h > +++ b/fs/overlayfs/overlayfs.h > @@ -258,6 +258,13 @@ bool ovl_need_index(struct dentry *dentry); > int ovl_nlink_start(struct dentry *dentry, bool *locked); > void ovl_nlink_end(struct dentry *dentry, bool locked); > int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *upperdir); > +void ovl_copytimes(struct inode *inode); > + > +static inline void ovl_copytimes_with_parent(struct dentry *dentry) > +{ > + ovl_copytimes(d_inode(dentry)); > + ovl_copytimes(d_inode(dentry->d_parent)); > +} > > static inline bool ovl_is_impuredir(struct dentry *dentry) > { > diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c > index 6f1078028c66..11e62e70733a 100644 > --- a/fs/overlayfs/util.c > +++ b/fs/overlayfs/util.c > @@ -675,3 +675,22 @@ int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *upperdir) > pr_err("overlayfs: failed to lock workdir+upperdir\n"); > return -EIO; > } > + > +void ovl_copytimes(struct inode *inode) > +{ > + struct inode *upperinode; > + > + if (!inode) > + return; > + > + upperinode = ovl_inode_upper(inode); > + > + if (!upperinode) > + return; > + > + if ((!timespec_equal(&inode->i_mtime, &upperinode->i_mtime) || > + !timespec_equal(&inode->i_ctime, &upperinode->i_ctime))) { > + inode->i_mtime = upperinode->i_mtime; > + inode->i_ctime = upperinode->i_ctime; > + } > +} > -- > 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