[Devel,vz7] fuse: fix typo in fuse_fiemap()

Submitted by Maxim Patlasov on July 17, 2017, 10:24 p.m.

Details

Message ID 150033023414.16760.13928492503924157560.stgit@maxim-thinkpad
State New
Series "fuse: fix typo in fuse_fiemap()"
Headers show

Commit Message

Maxim Patlasov July 17, 2017, 10:24 p.m.
fuse_fiemap() must honor return value of fuse_request_fiemap(). Otherwise:

> FIEMAP does not return errors in case of errors returned by fused.
> It is a very bad bug, in case of error the file looks as empty!

Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
---
 fs/fuse/file.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index f362d10..a24d89b 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -3821,7 +3821,6 @@  int fuse_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 	}
 
 	for (;;) {
-		int res;
 		int last = 0;
 		unsigned int npages;
 		u32 cur_max = fieinfo->fi_extents_max - fieinfo->fi_extents_mapped;
@@ -3835,8 +3834,8 @@  int fuse_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 			cur_max = (npages * PAGE_SIZE) / sizeof(struct fiemap_extent);
 		}
 
-		res = fuse_request_fiemap(inode, cur_max, &start, &len, &last, fieinfo);
-		if (res < 0)
+		err = fuse_request_fiemap(inode, cur_max, &start, &len, &last, fieinfo);
+		if (err < 0)
 			goto out;
 
 		if (len == 0 || last)