[Devel,RHEL7,COMMIT] ve/net/packet: show tx-ring warning only for host

Submitted by Konstantin Khorenko on March 24, 2017, 12:03 p.m.

Details

Message ID 201703241203.v2OC3bPx026225@finist_cl7.x64_64.work.ct
State New
Series "ve/net/packet: show tx-ring warning only for host"
Headers show

Commit Message

Konstantin Khorenko March 24, 2017, 12:03 p.m.
The commit is pushed to "branch-rh7-3.10.0-514.10.2.vz7.29.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.10.2.vz7.29.6
------>
commit 2dd0ab0ab60be81e2354e22cbc4206d12ae2d89b
Author: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Date:   Fri Mar 24 16:03:36 2017 +0400

    ve/net/packet: show tx-ring warning only for host
    
    Calling setsockopt(SOL_PACKET, PACKET_TX_RING) on TPACKET_V3 version
    fails with EINVAL and also generates these warning. That allows
    host log flood from CT, so do not show these warnings from inside CT.
    
    https://jira.sw.ru/browse/PSBM-56711
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 net/packet/af_packet.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index c15e57a..bc4a04e 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -3818,7 +3818,9 @@  static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
 	lock_sock(sk);
 	/* Opening a Tx-ring is NOT supported in TPACKET_V3 */
 	if (!closing && tx_ring && (po->tp_version > TPACKET_V2)) {
-		WARN(1, "Tx-ring is not supported.\n");
+		/* Hide warnings initiated from CT */
+		if (ve_is_super(get_exec_env()))
+			WARN(1, "Tx-ring is not supported.\n");
 		goto out;
 	}