Skip to contentSkip to conversation

tabled: Stub NULL session in events

PATCH Applied Pete Zaitcev 1 participant 1 message Apr 2, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 3/7 tabled: Stub NULL session in events

Currently ncld has a bug that causes it to report a session failure when session was not open yet. So, if a session fails to open, application crashes while trying to print the SID. This problem made this crash occur easily.

Unfortunately for us, there's more to it. If the library opened session, but is pre-empted before ncld_sess_open returns, the same situation may occur legitimately. So this check is still needed, unless we radically change the locking strategy.

---
 server/cldu.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

commit 446e8ca93ce624797a69841f38081faa369fee4a

Author: Pete Zaitcev <[email protected]>
Date:   Thu Apr 1 19:09:34 2010 -0600

Stub the problem with failure to open.

server/cldu.c +5 -2
index aecf336..fadc3d8 100644
@@ -176,8 +176,11 @@ static void cldu_sess_event(void *priv, uint32_t what)
 	struct cld_session *sp = priv;
 
 	if (what == CE_SESS_FAILED) {
-		applog(LOG_ERR, "Session failed, sid " SIDFMT,
-			       SIDARG(sp->nsp->udp->sess->sid));
+		if (sp->nsp)
+			applog(LOG_ERR, "Session failed, sid " SIDFMT,
+				       SIDARG(sp->nsp->udp->sess->sid));
+		else
+			applog(LOG_ERR, "Session open failed");
 		sp->is_dead = true;
 	} else {
 		if (sp->nsp)