[Devel] [PATCH 3/4] fs/fuse kio: add missed sock write in pcs_sock_sendmsg()

Pavel Butsykin pbutsykin at virtuozzo.com
Mon Apr 15 12:04:00 MSK 2019


We need to write the ready data to socket, in case write_queue list is empty,
instead of rescheduling it. This will help maintain a balance between recv and
send, because after rescheduling the receive will be called first.

Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_sock_io.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_sock_io.c b/fs/fuse/kio/pcs/pcs_sock_io.c
index ede71c255084..e0699f57a007 100644
--- a/fs/fuse/kio/pcs/pcs_sock_io.c
+++ b/fs/fuse/kio/pcs/pcs_sock_io.c
@@ -415,6 +415,8 @@ int pcs_sockio_delayed_seg(struct pcs_sockio *sio)
 
 void pcs_sock_sendmsg(struct pcs_sockio * sio, struct pcs_msg *msg)
 {
+	int was_idle = list_empty(&sio->write_queue);
+
 	DTRACE("sio(%p) msg:%p\n", sio, msg);
 
 	if (pcs_if_error(&sio->error)) {
@@ -432,6 +434,10 @@ void pcs_sock_sendmsg(struct pcs_sockio * sio, struct pcs_msg *msg)
 	if (!(sio->flags & PCS_SOCK_F_POOLOUT))
 		sio->flags |= PCS_SOCK_F_POOLOUT;
 
+	if (was_idle) {
+		sio->flags &= ~PCS_SOCK_F_POOLOUT;
+		pcs_sockio_send(sio);
+	}
 }
 
 /* Try to cancel message send. If it is impossible, because message is in the middle
-- 
2.15.1



More information about the Devel mailing list