linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ovl: fix incorrect extent info in metacopy case
@ 2020-06-24 10:20 Chengguang Xu
  2020-06-24 12:53 ` Amir Goldstein
  2020-08-14  9:23 ` cgxu
  0 siblings, 2 replies; 6+ messages in thread
From: Chengguang Xu @ 2020-06-24 10:20 UTC (permalink / raw)
  To: miklos; +Cc: linux-unionfs, Chengguang Xu

In metacopy case, we should use ovl_inode_realdata() instead of
ovl_inode_real() to get real inode which has data, so that
we can get correct information of extentes in ->fiemap operation.

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 fs/overlayfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 981f11ec51bc..a524af04b71d 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -472,7 +472,7 @@ static int ovl_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 		      u64 start, u64 len)
 {
 	int err;
-	struct inode *realinode = ovl_inode_real(inode);
+	struct inode *realinode = ovl_inode_realdata(inode);
 	const struct cred *old_cred;
 
 	if (!realinode->i_op->fiemap)
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ovl: fix incorrect extent info in metacopy case
  2020-06-24 10:20 [PATCH] ovl: fix incorrect extent info in metacopy case Chengguang Xu
@ 2020-06-24 12:53 ` Amir Goldstein
  2020-06-25  8:35   ` Amir Goldstein
  2020-08-14  9:23 ` cgxu
  1 sibling, 1 reply; 6+ messages in thread
From: Amir Goldstein @ 2020-06-24 12:53 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: Miklos Szeredi, overlayfs

On Wed, Jun 24, 2020 at 1:23 PM Chengguang Xu <cgxu519@mykernel.net> wrote:
>
> In metacopy case, we should use ovl_inode_realdata() instead of
> ovl_inode_real() to get real inode which has data, so that
> we can get correct information of extentes in ->fiemap operation.
>
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>

looks right

Reviewed-by: Amir Goldstein <amir73il@gmail.com>

> ---
>  fs/overlayfs/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
> index 981f11ec51bc..a524af04b71d 100644
> --- a/fs/overlayfs/inode.c
> +++ b/fs/overlayfs/inode.c
> @@ -472,7 +472,7 @@ static int ovl_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
>                       u64 start, u64 len)
>  {
>         int err;
> -       struct inode *realinode = ovl_inode_real(inode);
> +       struct inode *realinode = ovl_inode_realdata(inode);
>         const struct cred *old_cred;
>
>         if (!realinode->i_op->fiemap)
> --
> 2.20.1
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ovl: fix incorrect extent info in metacopy case
  2020-06-24 12:53 ` Amir Goldstein
@ 2020-06-25  8:35   ` Amir Goldstein
  2020-06-25  9:46     ` cgxu
  0 siblings, 1 reply; 6+ messages in thread
From: Amir Goldstein @ 2020-06-25  8:35 UTC (permalink / raw)
  To: Chengguang Xu, Miklos Szeredi; +Cc: overlayfs

On Wed, Jun 24, 2020 at 3:53 PM Amir Goldstein <amir73il@gmail.com> wrote:
>
> On Wed, Jun 24, 2020 at 1:23 PM Chengguang Xu <cgxu519@mykernel.net> wrote:
> >
> > In metacopy case, we should use ovl_inode_realdata() instead of
> > ovl_inode_real() to get real inode which has data, so that
> > we can get correct information of extentes in ->fiemap operation.
> >
> > Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
>
> looks right

Miklos,

Not related to this patch, I noticed something that could be odd with
ovl_fiemap().

When passed the flag FIEMAP_FLAG_SYNC, ->fiemap() will trigger writeback
of lower inode pages.

This behavior is border line for overlayfs.
I did not check if filemap_write_and_wait() ends up being a noop on read-only
fs or if it can return an error.
Following ovl_fsync() practice, we may want to silently drop the
FIEMAP_FLAG_SYNC flag? but that could result in unexpected results.

Am I overthinking this?

Thanks,
Amir.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ovl: fix incorrect extent info in metacopy case
  2020-06-25  8:35   ` Amir Goldstein
@ 2020-06-25  9:46     ` cgxu
  0 siblings, 0 replies; 6+ messages in thread
From: cgxu @ 2020-06-25  9:46 UTC (permalink / raw)
  To: Amir Goldstein, Miklos Szeredi; +Cc: overlayfs

On 6/25/20 4:35 PM, Amir Goldstein wrote:
> On Wed, Jun 24, 2020 at 3:53 PM Amir Goldstein <amir73il@gmail.com> wrote:
>> On Wed, Jun 24, 2020 at 1:23 PM Chengguang Xu <cgxu519@mykernel.net> wrote:
>>> In metacopy case, we should use ovl_inode_realdata() instead of
>>> ovl_inode_real() to get real inode which has data, so that
>>> we can get correct information of extentes in ->fiemap operation.
>>>
>>> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
>> looks right
> Miklos,
>
> Not related to this patch, I noticed something that could be odd with
> ovl_fiemap().
>
> When passed the flag FIEMAP_FLAG_SYNC, ->fiemap() will trigger writeback
> of lower inode pages.
>
> This behavior is border line for overlayfs.
> I did not check if filemap_write_and_wait() ends up being a noop on read-only
> fs or if it can return an error.

vfs ioctl does the same behavior regardless of read-only fs and IIUC,
writeback functions will do DIRTY tag check before actually sync dirty data.

Thanks,
cgxu

> Following ovl_fsync() practice, we may want to silently drop the
> FIEMAP_FLAG_SYNC flag? but that could result in unexpected results.
>
> Am I overthinking this?
>
> Thanks,
> Amir.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ovl: fix incorrect extent info in metacopy case
  2020-06-24 10:20 [PATCH] ovl: fix incorrect extent info in metacopy case Chengguang Xu
  2020-06-24 12:53 ` Amir Goldstein
@ 2020-08-14  9:23 ` cgxu
  2020-10-30 10:16   ` Miklos Szeredi
  1 sibling, 1 reply; 6+ messages in thread
From: cgxu @ 2020-08-14  9:23 UTC (permalink / raw)
  To: miklos; +Cc: linux-unionfs

On 6/24/20 6:20 PM, Chengguang Xu wrote:
> In metacopy case, we should use ovl_inode_realdata() instead of
> ovl_inode_real() to get real inode which has data, so that
> we can get correct information of extentes in ->fiemap operation.
> 
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>

ping


> ---
>   fs/overlayfs/inode.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
> index 981f11ec51bc..a524af04b71d 100644
> --- a/fs/overlayfs/inode.c
> +++ b/fs/overlayfs/inode.c
> @@ -472,7 +472,7 @@ static int ovl_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
>   		      u64 start, u64 len)
>   {
>   	int err;
> -	struct inode *realinode = ovl_inode_real(inode);
> +	struct inode *realinode = ovl_inode_realdata(inode);
>   	const struct cred *old_cred;
>   
>   	if (!realinode->i_op->fiemap)
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ovl: fix incorrect extent info in metacopy case
  2020-08-14  9:23 ` cgxu
@ 2020-10-30 10:16   ` Miklos Szeredi
  0 siblings, 0 replies; 6+ messages in thread
From: Miklos Szeredi @ 2020-10-30 10:16 UTC (permalink / raw)
  To: cgxu; +Cc: overlayfs

On Fri, Aug 14, 2020 at 11:23 AM cgxu <cgxu519@mykernel.net> wrote:
>
> On 6/24/20 6:20 PM, Chengguang Xu wrote:
> > In metacopy case, we should use ovl_inode_realdata() instead of
> > ovl_inode_real() to get real inode which has data, so that
> > we can get correct information of extentes in ->fiemap operation.
> >
> > Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
>
> ping

Sorry, I missed this patch.  Applied now.

Thanks,
Miklos

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-30 10:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 10:20 [PATCH] ovl: fix incorrect extent info in metacopy case Chengguang Xu
2020-06-24 12:53 ` Amir Goldstein
2020-06-25  8:35   ` Amir Goldstein
2020-06-25  9:46     ` cgxu
2020-08-14  9:23 ` cgxu
2020-10-30 10:16   ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).