[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio: reset write_iter for canceled msg

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 26 15:41:54 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.2.vz7.96.19
------>
commit ffd0e7d40241ce44efee525e97b9010391c29446
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Wed Jun 26 15:41:53 2019 +0300

    fs/fuse kio: reset write_iter for canceled msg
    
    Each message initializes its own iterator before sending message and resets it
    after sending. If the message is canceled by timeout in calendar_work(), but
    the iterator of this message isn't cleared, then sending the next message will
    fail. To fix this, let's reset sio->write_iter in pcs_sock_cancel_msg() if the
    message is currently being processed but sio->write_offset is still zero.
    
    https://pmc.acronis.com/browse/VSTOR-21044
    
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_sock_io.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_sock_io.c b/fs/fuse/kio/pcs/pcs_sock_io.c
index e0699f57a007..bae7610af826 100644
--- a/fs/fuse/kio/pcs/pcs_sock_io.c
+++ b/fs/fuse/kio/pcs/pcs_sock_io.c
@@ -449,9 +449,12 @@ int pcs_sock_cancel_msg(struct pcs_msg * msg)
 
 	BUG_ON(msg->sio == NULL);
 
-	if (sio->write_offset && sio->write_queue.next == &msg->list)
-		return -EBUSY;
-
+	if (sio->write_queue.next == &msg->list) {
+		if (sio->write_offset)
+			return -EBUSY;
+		else
+			iov_iter_init_bad(&sio->write_iter);
+	}
 	list_del_init(&msg->list);
 	sio->write_queue_len -= msg->size;
 	msg->stage = PCS_MSG_STAGE_SENT;



More information about the Devel mailing list