From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vivek Goyal Subject: Re: [PATCH 7/7] ovl: Fix ovl_getattr() to get size from lower Date: Fri, 6 Oct 2017 11:13:47 -0400 Message-ID: <20171006151347.GA10750@redhat.com> References: <1506951605-31440-1-git-send-email-vgoyal@redhat.com> <1506951605-31440-8-git-send-email-vgoyal@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mx1.redhat.com ([209.132.183.28]:43296 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751475AbdJFPNs (ORCPT ); Fri, 6 Oct 2017 11:13:48 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-unionfs-owner@vger.kernel.org List-Id: linux-unionfs@vger.kernel.org To: Amir Goldstein Cc: overlayfs , Miklos Szeredi On Mon, Oct 02, 2017 at 10:40:07PM +0300, Amir Goldstein wrote: > On Mon, Oct 2, 2017 at 4:40 PM, Vivek Goyal wrote: > > If an inode has been copied up metadata only, then we need to query the > > size from lower and fill up the stat->size. > > So you won't need this patch if you copy st_size on metadata_copy, > which seems like the logical thing to do. > Thinking very far into the future when METACOPY and ORIGIN will > be able to share page mappings, they will have to start with the same size. Hi Amir, What about "st_blocks"? After metadata copy up, doing stat on overlay file shows "st_blocks" as 0. I think I still will need to intervene and get st_blocks from lower file instead? Vivek > > > > > Signed-off-by: Vivek Goyal > > --- > > fs/overlayfs/inode.c | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c > > index e5825b8948e0..1b676deacc2d 100644 > > --- a/fs/overlayfs/inode.c > > +++ b/fs/overlayfs/inode.c > > @@ -140,6 +140,16 @@ int ovl_getattr(const struct path *path, struct kstat *stat, > > if (!is_dir && ovl_test_flag(OVL_INDEX, d_inode(dentry))) > > stat->nlink = dentry->d_inode->i_nlink; > > > > + if (ovl_test_flag(OVL_METACOPY, d_inode(dentry))) { > > + struct kstat lowerstat; > > + u32 lowermask = STATX_SIZE; > > + > > + ovl_path_lower(dentry, &realpath); > > + err = vfs_getattr(&realpath, &lowerstat, lowermask, flags); > > + if (err) > > + goto out; > > + stat->size = lowerstat.size; > > + } > > out: > > revert_creds(old_cred); > > > > -- > > 2.13.5 > >