]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
ibmvnic: Clear failover_pending if unable to schedule
authorSukadev Bhattiprolu <sukadev@linux.ibm.com>
Wed, 3 Feb 2021 05:08:02 +0000 (21:08 -0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 6 Feb 2021 18:36:22 +0000 (10:36 -0800)
Normally we clear the failover_pending flag when processing the reset.
But if we are unable to schedule a failover reset we must clear the
flag ourselves. We could fail to schedule the reset if we are in PROBING
state (eg: when booting via kexec) or because we could not allocate memory.

Thanks to Cris Forno for helping isolate the problem and for testing.

Fixes: 1d8504937478 ("powerpc/vnic: Extend "failover pending" window")
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Tested-by: Cristobal Forno <cforno12@linux.ibm.com>
Link: https://lore.kernel.org/r/20210203050802.680772-1-sukadev@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ibm/ibmvnic.c

index f79034c786c847427fbf8bc9ad6921049a9d84e7..a536fdbf05e196b58603c47c2c7de7c1a2afb9fe 100644 (file)
@@ -4918,7 +4918,22 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
                                complete(&adapter->init_done);
                                adapter->init_done_rc = -EIO;
                        }
-                       ibmvnic_reset(adapter, VNIC_RESET_FAILOVER);
+                       rc = ibmvnic_reset(adapter, VNIC_RESET_FAILOVER);
+                       if (rc && rc != -EBUSY) {
+                               /* We were unable to schedule the failover
+                                * reset either because the adapter was still
+                                * probing (eg: during kexec) or we could not
+                                * allocate memory. Clear the failover_pending
+                                * flag since no one else will. We ignore
+                                * EBUSY because it means either FAILOVER reset
+                                * is already scheduled or the adapter is
+                                * being removed.
+                                */
+                               netdev_err(netdev,
+                                          "Error %ld scheduling failover reset\n",
+                                          rc);
+                               adapter->failover_pending = false;
+                       }
                        break;
                case IBMVNIC_CRQ_INIT_COMPLETE:
                        dev_info(dev, "Partner initialization complete\n");