Whamcloud - gitweb
LU-2923 ptlrpc: Stop suppressing pings when IR is unavailable
authorLi Wei <wei.g.li@intel.com>
Sun, 31 Mar 2013 06:48:30 +0000 (14:48 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 9 Apr 2013 05:00:04 +0000 (01:00 -0400)
Currently, IR does not notify LWPs and MDT-MDT OSPs of target
recoveries.  This patch removes OBD_CONNECT_PINGLESS from LWP and
MDT-MDT OSP connect requests.

Although an MGC does not know if IR is administratively disabled on
the MGS or if a particular target is mounted with "noir", it can
detect MGSs that do not support IR at all and MGSs that are
unreachable.  This patch stops suppressing pings under those two
cases.

As a cleanup requested by the reviewers, this patch also replaces the
plain OBD_CONNECT_PINGLESS checks with OCD_HAS_FLAG(..., PINGLESS)
macros.

Change-Id: I993b46c8f33413793d9cf2fa1a73b3635996a206
Signed-off-by: Li Wei <wei.g.li@intel.com>
Reviewed-on: http://review.whamcloud.com/5900
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Tested-by: Hudson
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lustre_net.h
lustre/lod/lod_lov.c
lustre/mdt/mdt_handler.c
lustre/mgc/mgc_request.c
lustre/obdclass/obd_mount_server.c
lustre/ofd/ofd_obd.c
lustre/ptlrpc/pinger.c

index c5f5d86..9746c27 100644 (file)
@@ -3152,6 +3152,8 @@ void ping_evictor_stop(void);
 #define ping_evictor_stop()     do {} while (0)
 #endif
 int ptlrpc_check_and_wait_suspend(struct ptlrpc_request *req);
 #define ping_evictor_stop()     do {} while (0)
 #endif
 int ptlrpc_check_and_wait_suspend(struct ptlrpc_request *req);
+void ptlrpc_pinger_ir_up(void);
+void ptlrpc_pinger_ir_down(void);
 /** @} */
 int ptlrpc_pinger_suppress_pings(void);
 
 /** @} */
 int ptlrpc_pinger_suppress_pings(void);
 
index 9a9eec1..e99f646 100644 (file)
@@ -243,8 +243,7 @@ int lod_add_device(const struct lu_env *env, struct lod_device *lod,
                                           OBD_CONNECT_MDS_MDS |
                                           OBD_CONNECT_FID |
                                           OBD_CONNECT_AT |
                                           OBD_CONNECT_MDS_MDS |
                                           OBD_CONNECT_FID |
                                           OBD_CONNECT_AT |
-                                          OBD_CONNECT_FULL20 |
-                                          OBD_CONNECT_PINGLESS;
+                                          OBD_CONNECT_FULL20;
                /* XXX set MDS-MDS flags, remove this when running this
                 * on client*/
                data->ocd_connect_flags |= OBD_CONNECT_MDS_MDS;
                /* XXX set MDS-MDS flags, remove this when running this
                 * on client*/
                data->ocd_connect_flags |= OBD_CONNECT_MDS_MDS;
index b9e0c52..1a0d670 100644 (file)
@@ -5186,7 +5186,7 @@ static int mdt_connect_internal(struct obd_export *exp,
                return -EBADE;
        }
 
                return -EBADE;
        }
 
-       if (data->ocd_connect_flags & OBD_CONNECT_PINGLESS) {
+       if (OCD_HAS_FLAG(data, PINGLESS)) {
                if (ptlrpc_pinger_suppress_pings()) {
                        spin_lock(&exp->exp_obd->obd_dev_lock);
                        list_del_init(&exp->exp_obd_chain_timed);
                if (ptlrpc_pinger_suppress_pings()) {
                        spin_lock(&exp->exp_obd->obd_dev_lock);
                        list_del_init(&exp->exp_obd_chain_timed);
index 9e2357b..6b84a29 100644 (file)
@@ -1150,6 +1150,8 @@ static int mgc_import_event(struct obd_device *obd,
         switch (event) {
         case IMP_EVENT_DISCON:
                 /* MGC imports should not wait for recovery */
         switch (event) {
         case IMP_EVENT_DISCON:
                 /* MGC imports should not wait for recovery */
+               if (OCD_HAS_FLAG(&imp->imp_connect_data, IMP_RECOV))
+                       ptlrpc_pinger_ir_down();
                 break;
         case IMP_EVENT_INACTIVE:
                 break;
                 break;
         case IMP_EVENT_INACTIVE:
                 break;
@@ -1163,6 +1165,8 @@ static int mgc_import_event(struct obd_device *obd,
                /* Clearing obd_no_recov allows us to continue pinging */
                obd->obd_no_recov = 0;
                mgc_notify_active(obd);
                /* Clearing obd_no_recov allows us to continue pinging */
                obd->obd_no_recov = 0;
                mgc_notify_active(obd);
+               if (OCD_HAS_FLAG(&imp->imp_connect_data, IMP_RECOV))
+                       ptlrpc_pinger_ir_up();
                break;
         case IMP_EVENT_OCD:
                 break;
                break;
         case IMP_EVENT_OCD:
                 break;
index 86d19d7..ce7eba5 100644 (file)
@@ -522,8 +522,7 @@ static int lustre_lwp_connect(struct obd_device *lwp)
        data->ocd_connect_flags |= OBD_CONNECT_MDS_MDS | OBD_CONNECT_FID |
                OBD_CONNECT_AT | OBD_CONNECT_LRU_RESIZE |
                OBD_CONNECT_FULL20 | OBD_CONNECT_LVB_TYPE |
        data->ocd_connect_flags |= OBD_CONNECT_MDS_MDS | OBD_CONNECT_FID |
                OBD_CONNECT_AT | OBD_CONNECT_LRU_RESIZE |
                OBD_CONNECT_FULL20 | OBD_CONNECT_LVB_TYPE |
-               OBD_CONNECT_LIGHTWEIGHT |
-               OBD_CONNECT_PINGLESS;
+               OBD_CONNECT_LIGHTWEIGHT;
        OBD_ALLOC_PTR(uuid);
        if (uuid == NULL)
                GOTO(out, rc = -ENOMEM);
        OBD_ALLOC_PTR(uuid);
        if (uuid == NULL)
                GOTO(out, rc = -ENOMEM);
index 737c6f0..3bc97a0 100644 (file)
@@ -226,7 +226,7 @@ static int ofd_parse_connect_data(const struct lu_env *env,
        if (data->ocd_connect_flags & OBD_CONNECT_MAXBYTES)
                data->ocd_maxbytes = ofd->ofd_dt_conf.ddp_maxbytes;
 
        if (data->ocd_connect_flags & OBD_CONNECT_MAXBYTES)
                data->ocd_maxbytes = ofd->ofd_dt_conf.ddp_maxbytes;
 
-       if (data->ocd_connect_flags & OBD_CONNECT_PINGLESS) {
+       if (OCD_HAS_FLAG(data, PINGLESS)) {
                if (ptlrpc_pinger_suppress_pings()) {
                        spin_lock(&exp->exp_obd->obd_dev_lock);
                        list_del_init(&exp->exp_obd_chain_timed);
                if (ptlrpc_pinger_suppress_pings()) {
                        spin_lock(&exp->exp_obd->obd_dev_lock);
                        list_del_init(&exp->exp_obd_chain_timed);
index b19e96e..8b7d472 100644 (file)
@@ -232,6 +232,22 @@ int ptlrpc_check_and_wait_suspend(struct ptlrpc_request *req)
 
 #ifdef __KERNEL__
 
 
 #ifdef __KERNEL__
 
+static bool ir_up;
+
+void ptlrpc_pinger_ir_up(void)
+{
+       CDEBUG(D_HA, "IR up\n");
+       ir_up = true;
+}
+EXPORT_SYMBOL(ptlrpc_pinger_ir_up);
+
+void ptlrpc_pinger_ir_down(void)
+{
+       CDEBUG(D_HA, "IR down\n");
+       ir_up = false;
+}
+EXPORT_SYMBOL(ptlrpc_pinger_ir_down);
+
 static void ptlrpc_pinger_process_import(struct obd_import *imp,
                                          unsigned long this_ping)
 {
 static void ptlrpc_pinger_process_import(struct obd_import *imp,
                                          unsigned long this_ping)
 {
@@ -248,8 +264,7 @@ static void ptlrpc_pinger_process_import(struct obd_import *imp,
        /*
         * This will be used below only if the import is "FULL".
         */
        /*
         * This will be used below only if the import is "FULL".
         */
-       suppress = !!(imp->imp_connect_data.ocd_connect_flags &
-                     OBD_CONNECT_PINGLESS);
+       suppress = ir_up && OCD_HAS_FLAG(&imp->imp_connect_data, PINGLESS);
 
        imp->imp_force_verify = 0;
 
 
        imp->imp_force_verify = 0;
 
@@ -453,7 +468,7 @@ void ptlrpc_pinger_commit_expected(struct obd_import *imp)
         * imp_peer_committed_transno.
         */
        if (imp->imp_state != LUSTRE_IMP_FULL ||
         * imp_peer_committed_transno.
         */
        if (imp->imp_state != LUSTRE_IMP_FULL ||
-           imp->imp_connect_data.ocd_connect_flags & OBD_CONNECT_PINGLESS)
+           OCD_HAS_FLAG(&imp->imp_connect_data, PINGLESS))
                imp->imp_force_next_verify = 1;
 }
 
                imp->imp_force_next_verify = 1;
 }