PageRenderTime 45ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/SPECS/linux/0006-Drivers-hv-vss-Improve-log-messages.patch

https://gitlab.com/unofficial-mirrors/photon
Patch | 105 lines | 94 code | 11 blank | 0 comment | 0 complexity | 8c7e3b47a7e1f070046366e92fab5067 MD5 | raw file
  1. From b1fa05201756d5ce898c4ec183737041284624c7 Mon Sep 17 00:00:00 2001
  2. From: Alex Ng <alexng@messages.microsoft.com>
  3. Date: Sun, 6 Nov 2016 13:14:10 -0800
  4. Subject: [PATCH 06/13] Drivers: hv: vss: Improve log messages.
  5. Adding log messages to help troubleshoot error cases and transaction
  6. handling.
  7. Signed-off-by: Alex Ng <alexng@microsoft.com>
  8. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
  9. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  10. Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
  11. (cherry picked from commit 23d2cc0c29eb0e7c6fe4cac88098306c31c40208)
  12. ---
  13. drivers/hv/hv_snapshot.c | 25 +++++++++++++++++++------
  14. 1 file changed, 19 insertions(+), 6 deletions(-)
  15. diff --git a/drivers/hv/hv_snapshot.c b/drivers/hv/hv_snapshot.c
  16. index a76e3db0d01f..b1446d51ef45 100644
  17. --- a/drivers/hv/hv_snapshot.c
  18. +++ b/drivers/hv/hv_snapshot.c
  19. @@ -121,7 +121,7 @@ static int vss_handle_handshake(struct hv_vss_msg *vss_msg)
  20. default:
  21. return -EINVAL;
  22. }
  23. - pr_debug("VSS: userspace daemon ver. %d connected\n", dm_reg_value);
  24. + pr_info("VSS: userspace daemon ver. %d connected\n", dm_reg_value);
  25. return 0;
  26. }
  27. @@ -129,8 +129,10 @@ static int vss_on_msg(void *msg, int len)
  28. {
  29. struct hv_vss_msg *vss_msg = (struct hv_vss_msg *)msg;
  30. - if (len != sizeof(*vss_msg))
  31. + if (len != sizeof(*vss_msg)) {
  32. + pr_debug("VSS: Message size does not match length\n");
  33. return -EINVAL;
  34. + }
  35. if (vss_msg->vss_hdr.operation == VSS_OP_REGISTER ||
  36. vss_msg->vss_hdr.operation == VSS_OP_REGISTER1) {
  37. @@ -138,8 +140,11 @@ static int vss_on_msg(void *msg, int len)
  38. * Don't process registration messages if we're in the middle
  39. * of a transaction processing.
  40. */
  41. - if (vss_transaction.state > HVUTIL_READY)
  42. + if (vss_transaction.state > HVUTIL_READY) {
  43. + pr_debug("VSS: Got unexpected registration request\n");
  44. return -EINVAL;
  45. + }
  46. +
  47. return vss_handle_handshake(vss_msg);
  48. } else if (vss_transaction.state == HVUTIL_USERSPACE_REQ) {
  49. vss_transaction.state = HVUTIL_USERSPACE_RECV;
  50. @@ -156,7 +161,7 @@ static int vss_on_msg(void *msg, int len)
  51. }
  52. } else {
  53. /* This is a spurious call! */
  54. - pr_warn("VSS: Transaction not active\n");
  55. + pr_debug("VSS: Transaction not active\n");
  56. return -EINVAL;
  57. }
  58. return 0;
  59. @@ -169,8 +174,10 @@ static void vss_send_op(void)
  60. struct hv_vss_msg *vss_msg;
  61. /* The transaction state is wrong. */
  62. - if (vss_transaction.state != HVUTIL_HOSTMSG_RECEIVED)
  63. + if (vss_transaction.state != HVUTIL_HOSTMSG_RECEIVED) {
  64. + pr_debug("VSS: Unexpected attempt to send to daemon\n");
  65. return;
  66. + }
  67. vss_msg = kzalloc(sizeof(*vss_msg), GFP_KERNEL);
  68. if (!vss_msg)
  69. @@ -211,9 +218,13 @@ static void vss_handle_request(struct work_struct *dummy)
  70. case VSS_OP_HOT_BACKUP:
  71. if (vss_transaction.state < HVUTIL_READY) {
  72. /* Userspace is not registered yet */
  73. + pr_debug("VSS: Not ready for request.\n");
  74. vss_respond_to_host(HV_E_FAIL);
  75. return;
  76. }
  77. +
  78. + pr_debug("VSS: Received request for op code: %d\n",
  79. + vss_transaction.msg->vss_hdr.operation);
  80. vss_transaction.state = HVUTIL_HOSTMSG_RECEIVED;
  81. vss_send_op();
  82. return;
  83. @@ -356,8 +367,10 @@ hv_vss_init(struct hv_util_service *srv)
  84. hvt = hvutil_transport_init(vss_devname, CN_VSS_IDX, CN_VSS_VAL,
  85. vss_on_msg, vss_on_reset);
  86. - if (!hvt)
  87. + if (!hvt) {
  88. + pr_warn("VSS: Failed to initialize transport\n");
  89. return -EFAULT;
  90. + }
  91. return 0;
  92. }
  93. --
  94. 2.13.0