From: Andreas Dilger Date: Sat, 25 Jan 2014 01:16:43 +0000 (-0700) Subject: LU-4413 ptlrpc: don't try to recover no_recov connection X-Git-Tag: 2.5.56~15 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=c2fdaa739a0ff8e04531a3f153f132d631d1a16f LU-4413 ptlrpc: don't try to recover no_recov connection If a connection has been stopped with ptlrpc_pinger_del_import() and marked obd_no_recov, don't reconnect in ptlrpc_disconnect_import() if the import is already disconnected. Otherwise, without the pinger it will just wait there indefinitely for the reconnection that will never happen. Put the obd_no_recov check inside ptlrpc_import_in_recovery() so that any threads waiting on the connection to recover would also be broken out of their sleep if obd_no_recov is set. Signed-off-by: Andreas Dilger Change-Id: Icd8041be0ce344add8d67b026353df1b1e0cab07 Reviewed-on: http://review.whamcloud.com/8996 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: wangdi Reviewed-by: Oleg Drokin --- diff --git a/lustre/osp/lwp_dev.c b/lustre/osp/lwp_dev.c index 9560504..dc4f978 100644 --- a/lustre/osp/lwp_dev.c +++ b/lustre/osp/lwp_dev.c @@ -146,11 +146,9 @@ static int lwp_disconnect(struct lwp_device *d) * never added.) */ ptlrpc_pinger_del_import(imp); rc = ptlrpc_disconnect_import(imp, 0); - if (rc != 0 && rc != -ETIMEDOUT && rc != -ENOTCONN && rc != -ESHUTDOWN) + if (rc != 0) CWARN("%s: can't disconnect: rc = %d\n", d->lpd_obd->obd_name, rc); - else - rc = 0; ptlrpc_invalidate_import(imp); diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c index e3aad21..41272f0 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -329,9 +329,7 @@ static int osp_disconnect(struct osp_device *d) (void)ptlrpc_pinger_del_import(imp); rc = ptlrpc_disconnect_import(imp, 0); - if (rc == -ETIMEDOUT || rc == -ENOTCONN || rc == -ESHUTDOWN) - rc = 0; - if (rc) + if (rc != 0) CERROR("%s: can't disconnect: rc = %d\n", d->opd_obd->obd_name, rc); diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 3ba64d7..05d14e0 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -1439,29 +1439,36 @@ out: int ptlrpc_disconnect_import(struct obd_import *imp, int noclose) { - struct ptlrpc_request *req; - int rq_opc, rc = 0; - int nowait = imp->imp_obd->obd_force; - ENTRY; + struct ptlrpc_request *req; + int rq_opc, rc = 0; + ENTRY; - if (nowait) - GOTO(set_state, rc); - - switch (imp->imp_connect_op) { - case OST_CONNECT: rq_opc = OST_DISCONNECT; break; - case MDS_CONNECT: rq_opc = MDS_DISCONNECT; break; - case MGS_CONNECT: rq_opc = MGS_DISCONNECT; break; - default: - CERROR("don't know how to disconnect from %s (connect_op %d)\n", - obd2cli_tgt(imp->imp_obd), imp->imp_connect_op); - RETURN(-EINVAL); - } + if (imp->imp_obd->obd_force) + GOTO(set_state, rc); + + switch (imp->imp_connect_op) { + case OST_CONNECT: + rq_opc = OST_DISCONNECT; + break; + case MDS_CONNECT: + rq_opc = MDS_DISCONNECT; + break; + case MGS_CONNECT: + rq_opc = MGS_DISCONNECT; + break; + default: + rc = -EINVAL; + CERROR("%s: don't know how to disconnect from %s " + "(connect_op %d): rc = %d\n", + imp->imp_obd->obd_name, obd2cli_tgt(imp->imp_obd), + imp->imp_connect_op, rc); + RETURN(rc); + } if (ptlrpc_import_in_recovery(imp)) { struct l_wait_info lwi; cfs_duration_t timeout; - if (AT_OFF) { if (imp->imp_server_timeout) timeout = cfs_time_seconds(obd_timeout / 2); @@ -1484,7 +1491,6 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose) spin_lock(&imp->imp_lock); if (imp->imp_state != LUSTRE_IMP_FULL) GOTO(out, rc); - spin_unlock(&imp->imp_lock); req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_DISCONNECT, @@ -1517,6 +1523,8 @@ out: memset(&imp->imp_remote_handle, 0, sizeof(imp->imp_remote_handle)); spin_unlock(&imp->imp_lock); + if (rc == -ETIMEDOUT || rc == -ENOTCONN || rc == -ESHUTDOWN) + rc = 0; RETURN(rc); } EXPORT_SYMBOL(ptlrpc_disconnect_import); diff --git a/lustre/ptlrpc/recover.c b/lustre/ptlrpc/recover.c index 266e826..a5d6ae7 100644 --- a/lustre/ptlrpc/recover.c +++ b/lustre/ptlrpc/recover.c @@ -386,11 +386,14 @@ EXPORT_SYMBOL(ptlrpc_recover_import); int ptlrpc_import_in_recovery(struct obd_import *imp) { int in_recovery = 1; + spin_lock(&imp->imp_lock); if (imp->imp_state == LUSTRE_IMP_FULL || imp->imp_state == LUSTRE_IMP_CLOSED || - imp->imp_state == LUSTRE_IMP_DISCON) + imp->imp_state == LUSTRE_IMP_DISCON || + imp->imp_obd->obd_no_recov) in_recovery = 0; spin_unlock(&imp->imp_lock); + return in_recovery; }