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

Pavel Butsykin pbutsykin at virtuozzo.com
Tue Jun 25 17:40:25 MSK 2019


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.

#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;
-- 
2.15.1



More information about the Devel mailing list