[RHEL7,COMMIT] fuse kio: never ignore fuse_req error during PCS_IOC_GETMAP

Submitted by Konstantin Khorenko on Nov. 24, 2018, 3:01 p.m.

Details

Message ID 201811241500.wAOF0wWO030250@finist-ce7.sw.ru
State New
Series "fuse kio: never ignore fuse_req error during PCS_IOC_GETMAP"
Headers show

Commit Message

Konstantin Khorenko Nov. 24, 2018, 3:01 p.m.
The commit is pushed to "branch-rh7-3.10.0-862.20.2.vz7.73.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.20.2.vz7.73.8
------>
commit ce803d074c40ac88744845a511ff41252992968e
Author: Anton Nefedov <anton.nefedov@virtuozzo.com>
Date:   Sat Nov 24 18:00:58 2018 +0300

    fuse kio: never ignore fuse_req error during PCS_IOC_GETMAP
    
    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)