Skip to content

Commit c64e242

Browse files
committed
DEBUG: stconn: Add a BUG_ON on shut flags when the endpoint is shut
Whne the endpoint is shut (an applet or a mux), at least one of the SHW flags must be set (SE_SHW_SILENT or SE_SHW_NORMAL). It is mandatory for muxes to perform the shutdown. Otherwise, the shutdown could be ignored. So let's add a BUG_ON() on it to be sure this never happen.
1 parent 5530f50 commit c64e242

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/stconn.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ void se_shutdown(struct sedesc *sedesc, enum se_shut_mode mode)
9191
struct se_abort_info *reason = NULL;
9292
unsigned int flags = 0;
9393

94+
/* Should never happen, placed here to be sure we forgot nothing */
95+
BUG_ON(!(mode & (SE_SHW_SILENT|SE_SHW_NORMAL)));
96+
9497
if ((mode & (SE_SHW_SILENT|SE_SHW_NORMAL)) && !se_fl_test(sedesc, SE_FL_SHW)) {
9598
se_report_term_evt(sedesc, se_tevt_type_shutw);
9699
flags |= (mode & SE_SHW_NORMAL) ? SE_FL_SHWN : SE_FL_SHWS;

0 commit comments

Comments
 (0)