($INBOX_DIR/description missing)
 help / color / 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
  0 siblings, 1 reply; 4+ 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	[flat|nested] 4+ 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
  0 siblings, 1 reply; 4+ 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] 4+ 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; 4+ 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] 4+ 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; 4+ 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] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ 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

($INBOX_DIR/description missing)

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-unionfs/0 linux-unionfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-unionfs linux-unionfs/ https://lore.kernel.org/linux-unionfs \
		linux-unionfs@vger.kernel.org
	public-inbox-index linux-unionfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-unionfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git