ovl: fix incorrect extent info in metacopy case
PATCH 1/1 ovl: fix incorrect extent info in metacopy case
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.
--- fs/overlayfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/overlayfs/inode.c +1 -1
@@ -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)
Signature · 1 line
2.20.1
Quoted 6 lines · Chengguang Xu
In metacopy case, we should use
ovl_inode_realdata()instead ofovl_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 <[email protected]>
looks right
Quoted 21 lines
--- fs/overlayfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/overlayfs/inode.c +1
-2@@ -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
Amir Goldstein
maintainerQuoted 10 lines · Amir Goldstein
Quoted 6 lines · Chengguang Xu
In metacopy case, we should use
ovl_inode_realdata()instead ofovl_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 <[email protected]>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.
Quoted 13 lines · Amir Goldstein
Quoted 7 lines · Amir Goldstein
Quoted 5 lines · Chengguang Xu
In metacopy case, we should use
ovl_inode_realdata()instead ofovl_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 <[email protected]>looks right
Miklos,
Not related to this patch, I noticed something that could be odd with
ovl_fiemap().
Quoted 6 lines
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 iffilemap_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
Quoted 7 lines
Following
ovl_fsync()practice, we may want to silently drop theFIEMAP_FLAG_SYNCflag? but that could result in unexpected results.Am I overthinking this?
Thanks,
Amir.
Quoted 5 lines · Chengguang Xu
In metacopy case, we should use
ovl_inode_realdata()instead ofovl_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 <[email protected]>
ping
Quoted 18 lines
--- fs/overlayfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/overlayfs/inode.c +1
-1@@ -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)
Miklos Szeredi
maintainerQuoted 9 lines · cgxu
Quoted 5 lines · Chengguang Xu
In metacopy case, we should use
ovl_inode_realdata()instead ofovl_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 <[email protected]>ping
Sorry, I missed this patch. Applied now.
Thanks,
Miklos