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

Maxim Patlasov mpatlasov at virtuozzo.com
Tue Jul 18 01:24:07 MSK 2017


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 at virtuozzo.com>
Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 fs/fuse/file.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

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)



More information about the Devel mailing list