staging/lustre/lnet: Get rid of IOC_LIBCFS_DEBUG_PEER hack
authorOleg Drokin <green@linuxhacker.ru>
Sun, 3 Jan 2016 17:05:33 +0000 (12:05 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Feb 2016 22:27:25 +0000 (14:27 -0800)
IOC_LIBCFS_DEBUG_PEER was added back in the stone ages to print debug
statistics on a peer when peer timeout happens.
Redo it properly as a separate LNet API call,
also get rid of "ioctl" forwarding into the underlying LNDs,
since no current LNDs implement this function anymore.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
drivers/staging/lustre/include/linux/lnet/api.h
drivers/staging/lustre/lnet/lnet/api-ni.c
drivers/staging/lustre/lustre/ptlrpc/client.c

index 485ab267091859214576da349e2bf89a5874667d..7c5e5c805fe601bf40bb18b4eb1f1b49b0c28a83 100644 (file)
@@ -123,7 +123,7 @@ struct libcfs_ioctl_handler {
 #define IOC_LIBCFS_CONFIGURE          _IOWR('e', 59, long)
 #define IOC_LIBCFS_TESTPROTOCOMPAT      _IOWR('e', 60, long)
 #define IOC_LIBCFS_PING                    _IOWR('e', 61, long)
-#define IOC_LIBCFS_DEBUG_PEER        _IOWR('e', 62, long)
+/*     #define IOC_LIBCFS_DEBUG_PEER         _IOWR('e', 62, long) */
 #define IOC_LIBCFS_LNETST                _IOWR('e', 63, long)
 /* lnd ioctls */
 #define IOC_LIBCFS_REGISTER_MYNID        _IOWR('e', 70, long)
index 75285fde15e8c06270e99bb0c0bd1409121a5dce..fa5fad3582b395b66abfbec03656006f1a54ffb3 100644 (file)
@@ -197,6 +197,7 @@ int LNetGet(lnet_nid_t            self,
 int LNetSetLazyPortal(int portal);
 int LNetClearLazyPortal(int portal);
 int LNetCtl(unsigned int cmd, void *arg);
+void LNetDebugPeer(lnet_process_id_t id);
 
 /** @} lnet_misc */
 
index de453ceb8649b4c63f69d368b4a74f0c84844b3e..94ccef56c4bf5e9703b34cc8a3fb2eb60a966408 100644 (file)
@@ -1316,17 +1316,10 @@ LNetNIFini(void)
 EXPORT_SYMBOL(LNetNIFini);
 
 /**
- * This is an ugly hack to export IOC_LIBCFS_DEBUG_PEER and
- * IOC_LIBCFS_PORTALS_COMPATIBILITY commands to users, by tweaking the LNet
- * internal ioctl handler.
+ * LNet ioctl handler.
  *
  * IOC_LIBCFS_PORTALS_COMPATIBILITY is now deprecated, don't use it.
  *
- * \param cmd IOC_LIBCFS_DEBUG_PEER to print debugging data about a peer.
- * The data will be printed to system console. Don't use it excessively.
- * \param arg A pointer to lnet_process_id_t, process ID of the peer.
- *
- * \return Always return 0 when called by users directly (i.e., not via ioctl).
  */
 int
 LNetCtl(unsigned int cmd, void *arg)
@@ -1396,29 +1389,6 @@ LNetCtl(unsigned int cmd, void *arg)
                data->ioc_count = rc;
                return 0;
 
-       case IOC_LIBCFS_DEBUG_PEER: {
-               /* CAVEAT EMPTOR: this one designed for calling directly; not
-                * via an ioctl */
-               id = *((lnet_process_id_t *) arg);
-
-               lnet_debug_peer(id.nid);
-
-               ni = lnet_net2ni(LNET_NIDNET(id.nid));
-               if (ni == NULL) {
-                       CDEBUG(D_WARNING, "No NI for %s\n", libcfs_id2str(id));
-               } else {
-                       if (ni->ni_lnd->lnd_ctl == NULL) {
-                               CDEBUG(D_WARNING, "No ctl for %s\n",
-                                      libcfs_id2str(id));
-                       } else {
-                               (void)ni->ni_lnd->lnd_ctl(ni, cmd, arg);
-                       }
-
-                       lnet_ni_decref(ni);
-               }
-               return 0;
-       }
-
        default:
                ni = lnet_net2ni(data->ioc_net);
                if (ni == NULL)
@@ -1436,6 +1406,12 @@ LNetCtl(unsigned int cmd, void *arg)
 }
 EXPORT_SYMBOL(LNetCtl);
 
+void LNetDebugPeer(lnet_process_id_t id)
+{
+       lnet_debug_peer(id.nid);
+}
+EXPORT_SYMBOL(LNetDebugPeer);
+
 /**
  * Retrieve the lnet_process_id_t ID of LNet interface at \a index. Note that
  * all interfaces share a same PID, as requested by LNetNIInit().
index 8f3c26f1398f219b2af9243c7c2b344296858e98..1cc3c69a175a39f58ba5b544a3c8381263a55491 100644 (file)
@@ -1884,7 +1884,7 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink)
                  (s64)req->rq_sent, (s64)req->rq_real_sent);
 
        if (imp != NULL && obd_debug_peer_on_timeout)
-               LNetCtl(IOC_LIBCFS_DEBUG_PEER, &imp->imp_connection->c_peer);
+               LNetDebugPeer(imp->imp_connection->c_peer);
 
        ptlrpc_unregister_reply(req, async_unlink);
        ptlrpc_unregister_bulk(req, async_unlink);