BUG/MEDIUM: mux-pt: Fix condition to perform a shutdown for writes in mux_pt_shut()

A regression was introduced in the commit 76fa71f7a ("BUG/MEDIUM: mux-pt:
Never fully close the connection on shutdown") because of a typo on the
connection flags. CO_FL_SOCK_WR_SH flag must be tested to prevent a call to
conn_sock_shutw() and not CO_FL_SOCK_RD_SH.

Concretly, most of time, it is harmeless because shutdown for writes is
always performed before any shutdown for reads. Except in case describe by
the commit above. But it is not clear if it has an impact or not.

This patch must be backported with the commit above, so as far as 2.9.
This commit is contained in:
Christopher Faulet 2024-09-03 15:19:51 +02:00
parent 7e19432fd4
commit e1cae42879

View File

@ -470,7 +470,7 @@ static void mux_pt_shut(struct stconn *sc, unsigned int mode, struct se_abort_in
if (mode & (SE_SHW_SILENT|SE_SHW_NORMAL)) {
if (conn_xprt_ready(conn) && conn->xprt->shutw)
conn->xprt->shutw(conn, conn->xprt_ctx, (mode & SE_SHW_NORMAL));
if (!(conn->flags & CO_FL_SOCK_RD_SH))
if (!(conn->flags & CO_FL_SOCK_WR_SH))
conn_sock_shutw(conn, (mode & SE_SHW_NORMAL));
}