diff options
| author | Christian Hopps <chopps@labn.net> | 2023-05-16 08:23:09 -0400 | 
|---|---|---|
| committer | Christian Hopps <chopps@labn.net> | 2023-05-30 02:09:51 -0400 | 
| commit | 7a0894b5325e85f9d3d27d867bd091abec1ef0e4 (patch) | |
| tree | d891c3fe289326be027538c0c04ebea2a05df40a /mgmtd | |
| parent | acd7aea00ee6d23bff4ebb8bb0e7ab6a32874c9b (diff) | |
mgmtd: Add note to SETCFG_REQ and debug logging
- convert impossible situation into assert
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'mgmtd')
| -rw-r--r-- | mgmtd/mgmt_fe_adapter.c | 13 | 
1 files changed, 11 insertions, 2 deletions
diff --git a/mgmtd/mgmt_fe_adapter.c b/mgmtd/mgmt_fe_adapter.c index 7327940c19..7509d24a6a 100644 --- a/mgmtd/mgmt_fe_adapter.c +++ b/mgmtd/mgmt_fe_adapter.c @@ -755,6 +755,11 @@ mgmt_fe_session_handle_lockds_req_msg(struct mgmt_fe_session_ctx *session,  	return 0;  } +/* + * TODO: this function has too many conditionals relating to complex error + * conditions. It needs to be simplified and these complex error conditions + * probably need to just disconnect the client with a suitably loud log message. + */  static int  mgmt_fe_session_handle_setcfg_req_msg(struct mgmt_fe_session_ctx *session,  					  Mgmtd__FeSetConfigReq *setcfg_req) @@ -796,8 +801,8 @@ mgmt_fe_session_handle_setcfg_req_msg(struct mgmt_fe_session_ctx *session,  		 * from another session is already in progress.  		 */  		cfg_session_id = mgmt_config_txn_in_progress(); -		if (cfg_session_id != MGMTD_SESSION_ID_NONE -		   && cfg_session_id != session->session_id) { +		if (cfg_session_id != MGMTD_SESSION_ID_NONE) { +			assert(cfg_session_id != session->session_id);  			mgmt_fe_send_setcfg_reply(  				session, setcfg_req->ds_id, setcfg_req->req_id,  				false, @@ -811,6 +816,10 @@ mgmt_fe_session_handle_setcfg_req_msg(struct mgmt_fe_session_ctx *session,  		 * Try taking write-lock on the requested DS (if not already).  		 */  		if (!session->ds_write_locked[setcfg_req->ds_id]) { +			MGMTD_FE_ADAPTER_ERR( +				"SETCFG_REQ on session-id: %" PRIu64 +				" without obtaining lock", +				session->session_id);  			if (mgmt_fe_session_write_lock_ds(setcfg_req->ds_id,  							      ds_ctx, session)  			    != 0) {  | 
