[v2] fuse kio: never ignore fuse_req error during PCS_IOC_GETMAP

Submitted by Anton Nefedov on Nov. 23, 2018, 12:40 p.m.

Details

Message ID 20181123124034.108979-1-anton.nefedov@virtuozzo.com
State New
Series "fuse kio: never ignore fuse_req error during PCS_IOC_GETMAP"
Headers show

Commit Message

Anton Nefedov Nov. 23, 2018, 12:40 p.m.
if ioctl returns error its result cannot be interpreted. Propagate
the error into the resulting pcs_ioc_getmap structure unconditionally.

Since VERSION 1.2 fused properly sets fuse_ioctl_out::result (which passed
into work->status)

Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 6 ++++--
 fs/fuse/kio/pcs/pcs_ioctl.h        | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index d1d3f7f4a256..3b1d819792b2 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -425,8 +425,10 @@  static void fuse_complete_map_work(struct work_struct *w)
 
 	BUG_ON(!m);
 	BUG_ON(!omap);
-	pcs_copy_error_cond(&omap->error, &work->status);
-	if (omap->cs_cnt > MAX_CS_CNT) {
+
+	if (pcs_if_error(&work->status)) {
+		pcs_copy_error(&omap->error, &work->status);
+	} else if (omap->cs_cnt > MAX_CS_CNT) {
 		printk("Corrupted cs_cnt from userspace");
 		pcs_set_local_error(&omap->error, PCS_ERR_PROTOCOL);
 	}
diff --git a/fs/fuse/kio/pcs/pcs_ioctl.h b/fs/fuse/kio/pcs/pcs_ioctl.h
index b36bc653b210..5cf40e35f881 100644
--- a/fs/fuse/kio/pcs/pcs_ioctl.h
+++ b/fs/fuse/kio/pcs/pcs_ioctl.h
@@ -10,7 +10,7 @@ 
 #include "pcs_map.h"
 #include "pcs_rpc.h"
 
-#define PCS_FAST_PATH_VERSION ((PCS_FAST_PATH_VERSION_T){1, 1})
+#define PCS_FAST_PATH_VERSION ((PCS_FAST_PATH_VERSION_T){1, 2})
 
 #define PCS_FUSE_INO_SPECIAL_ ((unsigned long long)-0x1000)