From: Amir Shehata Date: Thu, 8 May 2014 17:47:56 +0000 (-0700) Subject: LU-3353 ptlrpc: Suppress error message when imp_sec is freed X-Git-Tag: 2.6.92~63 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=edf6116663724467207422dcc0c6120320055cac;p=fs%2Flustre-release.git LU-3353 ptlrpc: Suppress error message when imp_sec is freed There is a race condition on client reconnect when the import is being destroyed. Some outstanding client bound requests are being processed when the imp_sec has alread been freed. Ensure to suppress the error message in import_sec_validate_get() in that case Signed-off-by: Amir Shehata Change-Id: I44bc27c804259d4e4b6564460318732113b251a9 Reviewed-on: http://review.whamcloud.com/10200 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/ptlrpc/sec.c b/lustre/ptlrpc/sec.c index c8f7731..5f997e7 100644 --- a/lustre/ptlrpc/sec.c +++ b/lustre/ptlrpc/sec.c @@ -369,31 +369,46 @@ static int import_sec_check_expire(struct obd_import *imp) return sptlrpc_import_sec_adapt(imp, NULL, 0); } +/** + * Get and validate the client side ptlrpc security facilities from + * \a imp. There is a race condition on client reconnect when the import is + * being destroyed while there are outstanding client bound requests. In + * this case do not output any error messages if import secuity is not + * found. + * + * \param[in] imp obd import associated with client + * \param[out] sec client side ptlrpc security + * + * \retval 0 if security retrieved successfully + * \retval -ve errno if there was a problem + */ static int import_sec_validate_get(struct obd_import *imp, - struct ptlrpc_sec **sec) + struct ptlrpc_sec **sec) { - int rc; + int rc; - if (unlikely(imp->imp_sec_expire)) { - rc = import_sec_check_expire(imp); - if (rc) - return rc; - } + if (unlikely(imp->imp_sec_expire)) { + rc = import_sec_check_expire(imp); + if (rc) + return rc; + } - *sec = sptlrpc_import_sec_ref(imp); - if (*sec == NULL) { - CERROR("import %p (%s) with no sec\n", - imp, ptlrpc_import_state_name(imp->imp_state)); - return -EACCES; - } + *sec = sptlrpc_import_sec_ref(imp); + /* Only output an error when the import is still active */ + if (*sec == NULL) { + if (list_empty(&imp->imp_zombie_chain)) + CERROR("import %p (%s) with no sec\n", + imp, ptlrpc_import_state_name(imp->imp_state)); + return -EACCES; + } - if (unlikely((*sec)->ps_dying)) { - CERROR("attempt to use dying sec %p\n", sec); - sptlrpc_sec_put(*sec); - return -EACCES; - } + if (unlikely((*sec)->ps_dying)) { + CERROR("attempt to use dying sec %p\n", sec); + sptlrpc_sec_put(*sec); + return -EACCES; + } - return 0; + return 0; } /**