virtiofs: fix return value of iomap_begin_upgrade_mapping
PATCH 1/1 virtiofs: fix return value of iomap_begin_upgrade_mapping
Set ret = 0 if everything runs fine.
--- fs/fuse/file.c | 1 + 1 file changed, 1 insertion(+)
fs/fuse/file.c +1 -0
@@ -1985,6 +1985,7 @@ static int iomap_begin_upgrade_mapping(struct inode *inode, loff_t pos, out_fill_iomap:fuse_fill_iomap (inode, pos, length, iomap, dmap, flags); + ret =0 ; out_err:up_write (&fi->i_dmap_sem);return ret;
Signature · 1 line
1.8.3.1
Quoted 3 lines · Liu Bo
Set ret = 0 if everything runs fine.
Signed-off-by Liu Bo <[email protected]>
FYI, this fixes generic/344 failure.
fs/fuse/file.c static int iomap_begin_upgrade_mapping(struct inode *inode, loff_t pos, · line 1988
Quoted 13 lines
--- fs/fuse/file.c | 1 + 1 file changed, 1 insertion(+)fs/fuse/file.c +1
-0@@ -1985,6 +1985,7 @@ static int iomap_begin_upgrade_mapping(struct inode *inode, loff_t pos, out_fill_iomap:fuse_fill_iomap (inode, pos, length, iomap, dmap, flags); + ret =0 ;
I'd prefer setting ret in the if (dmap->writable) case, which seems more clear to me. i.e.
if (dmap->writable) {
ret = 0;
goto out_fill_iomap;
}Anyway,
Thanks!
Eryu
Quoted 10 lines
fs/fuse/file.c +0
-0out_err:up_write (&fi->i_dmap_sem);return ret;Signature · 6 lines
1.8.3.1 _______________________________________________ Virtio-fs mailing list [email protected] https://www.redhat.com/mailman/listinfo/virtio-fs
piaojun
Reviewed-byQuoted 24 lines · Eryu Guan
Quoted 3 lines · Liu Bo
Set ret = 0 if everything runs fine.
Signed-off-by Liu Bo <[email protected]>FYI, this fixes generic/344 failure.
fs/fuse/file.c static int iomap_begin_upgrade_mapping(struct inode *inode, loff_t pos, · line 1988
Quoted 13 lines
--- fs/fuse/file.c | 1 + 1 file changed, 1 insertion(+)fs/fuse/file.c +1
-0@@ -1985,6 +1985,7 @@ static int iomap_begin_upgrade_mapping(struct inode *inode, loff_t pos, out_fill_iomap:fuse_fill_iomap (inode, pos, length, iomap, dmap, flags); + ret =0 ;I'd prefer setting ret in the if (
dmap->writable) case, which seems more clear to me. i.e.
Quoted 4 lines
if (dmap->writable) {
ret = 0;
goto out_fill_iomap;
}Agreed, and feel free to add:
Jun
Quoted 12 lines · Liu Bo
Set ret = 0 if everything runs fine.
Signed-off-by Liu Bo <[email protected]>--- fs/fuse/file.c | 1 + 1 file changed, 1 insertion(+)fs/fuse/file.c +0
-0
fs/fuse/file.c static int iomap_begin_upgrade_mapping(struct inode *inode, loff_t pos, · line 1988
Quoted 4 lines
fs/fuse/file.c +1
-0@@ -1985,6 +1985,7 @@ static int iomap_begin_upgrade_mapping(struct inode *inode, loff_t pos, out_fill_iomap:fuse_fill_iomap (inode, pos, length, iomap, dmap, flags); + ret =0 ;
Thanks. I initialized ret = 0 in the beginning itself now.
Vivek
Quoted 10 lines
fs/fuse/file.c +0
-0out_err:up_write (&fi->i_dmap_sem);return ret;Signature · 6 lines
1.8.3.1 _______________________________________________ Virtio-fs mailing list [email protected] https://www.redhat.com/mailman/listinfo/virtio-fs
Quoted 14 lines · Vivek Goyal
Quoted 13 lines · Liu Bo
Set ret = 0 if everything runs fine.
Signed-off-by Liu Bo <[email protected]>--- fs/fuse/file.c | 1 + 1 file changed, 1 insertion(+)fs/fuse/file.c +0
-0@@ -1985,6 +1985,7 @@ static int iomap_begin_upgrade_mapping(struct inode *inode, loff_t pos,
Quoted 5 lines
fs/fuse/file.c static int iomap_begin_upgrade_mapping(struct inode *inode, loff_t pos, · line 1988
Quoted 3 lines
fs/fuse/file.c +1
-0out_fill_iomap:fuse_fill_iomap (inode, pos, length, iomap, dmap, flags); + ret =0 ;Thanks. I initialized ret = 0 in the beginning itself now.
This probably would not work as ret will be set -EIO again immediately.
Jun
Quoted 17 lines · piaojun
Quoted 14 lines · Vivek Goyal
Quoted 13 lines · Liu Bo
Set ret = 0 if everything runs fine.
Signed-off-by Liu Bo <[email protected]>--- fs/fuse/file.c | 1 + 1 file changed, 1 insertion(+)fs/fuse/file.c +0
-0@@ -1985,6 +1985,7 @@ static int iomap_begin_upgrade_mapping(struct inode *inode, loff_t pos,
Quoted 7 lines
Quoted 5 lines
fs/fuse/file.c static int iomap_begin_upgrade_mapping(struct inode *inode, loff_t pos, · line 1988
Quoted 3 lines
fs/fuse/file.c +1
-0out_fill_iomap:fuse_fill_iomap (inode, pos, length, iomap, dmap, flags); + ret =0 ;Thanks. I initialized ret = 0 in the beginning itself now.
This probably would not work as ret will be set
-EIOagain immediately.
I changed that ret = -EIO as well. I now set it only when error happens.
Vivek