[RHEL7,COMMIT] fs/fuse kio: add FUSE_S_FAIL_IMMEDIATELY check in pcs_fuse_submit()

Submitted by Konstantin Khorenko on Feb. 4, 2019, 9:27 a.m.

Details

Message ID 201902040927.x149RhR4019868@finist-ce7.sw.ru
State New
Series "Series without cover letter"
Headers show

Commit Message

Konstantin Khorenko Feb. 4, 2019, 9:27 a.m.
The commit is pushed to "branch-rh7-3.10.0-957.1.3.vz7.83.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.1.3.vz7.83.10
------>
commit 563571084bb3a15296b1eb6345abb95b388341f2
Author: Pavel Butsykin <pbutsykin@virtuozzo.com>
Date:   Mon Feb 4 12:27:43 2019 +0300

    fs/fuse kio: add FUSE_S_FAIL_IMMEDIATELY check in pcs_fuse_submit()
    
    Fuse file with FUSE_S_FAIL_IMMEDIATELY state should not allow to execute new
    requests. But in case of kio requests it doesn't work because the status check
    is located behind kio.op->req_send(). To fix this let's add the status check
    in pcs_fuse_submit().
    
    Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 5 +++++
 1 file changed, 5 insertions(+)

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 c5e9956e3dca..55a11a3a925a 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -990,6 +990,11 @@  static void pcs_fuse_submit(struct pcs_fuse_cluster *pfc, struct fuse_req *req,
 
 submit:
 	spin_lock(&di->kq_lock);
+	if (req->ff && test_bit(FUSE_S_FAIL_IMMEDIATELY, &req->ff->ff_state)) {
+		spin_unlock(&di->kq_lock);
+		req->out.h.error = -EIO;
+		goto error;
+	}
 	list_add_tail(&req->list, &di->kq);
 	spin_unlock(&di->kq_lock);