Skip to content

Commit

Permalink
linux-rt: Fix patch to apply on linux-rt
Browse files Browse the repository at this point in the history
Change-Id: Ia6caa67160b2014eef43ea471d0aeabc39b51709
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/8736
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
  • Loading branch information
bordoloih authored and suezzelur committed Dec 13, 2019
1 parent cc65118 commit 8fba5e7
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
46 changes: 46 additions & 0 deletions SUNRPC-xs_bind-uses-ip_local_reserved_ports_linux_rt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From 5ff0b9e728e23e54001c2bb6df29d85ac2c5e08f Mon Sep 17 00:00:00 2001
From: Alexey Makhalov <amakhalov@vmware.com>
Date: Fri, 25 Mar 2016 21:51:12 +0000
Subject: [PATCH] sunrpc: xs_bind uses ip_local_reserved_ports

---
net/sunrpc/xprtsock.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 2ffaf6a..90543d6 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1798,9 +1798,11 @@ static unsigned short xs_next_srcport(struct sock_xprt *transport, unsigned shor
static int xs_bind(struct sock_xprt *transport, struct socket *sock)
{
struct sockaddr_storage myaddr;
- int err, nloop = 0;
+ int err = -EADDRINUSE;
+ int nloop = 0;
unsigned short port = xs_get_srcport(transport);
unsigned short last;
+ struct net *net = transport->xprt.xprt_net;

/*
* If we are asking for any ephemeral port (i.e. port == 0 &&
@@ -1822,6 +1824,8 @@ static int xs_bind(struct sock_xprt *transport, struct socket *sock)

memcpy(&myaddr, &transport->srcaddr, transport->xprt.addrlen);
do {
+ if (inet_is_local_reserved_port(net, port))
+ goto next_port;
rpc_set_port((struct sockaddr *)&myaddr, port);
err = kernel_bind(sock, (struct sockaddr *)&myaddr,
transport->xprt.addrlen);
@@ -1829,6 +1833,7 @@ static int xs_bind(struct sock_xprt *transport, struct socket *sock)
transport->srcport = port;
break;
}
+next_port:
last = port;
port = xs_next_srcport(transport, port);
if (port > last)
--
1.9.1

6 changes: 4 additions & 2 deletions linux-rt.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Name: linux-rt
Version: 4.19.82
# Keep rt_version matched up with REBASE.patch
%define rt_version rt30
Release: 1%{?kat_build:.%kat_build}%{?dist}
Release: 2%{?kat_build:.%kat_build}%{?dist}
License: GPLv2
URL: http://www.kernel.org/
Group: System Environment/Kernel
Expand All @@ -24,7 +24,7 @@ Patch1: double-tcp_mem-limits.patch
# TODO: disable this patch, check for regressions
#Patch2: linux-4.9-watchdog-Disable-watchdog-on-virtual-machines.patch
Patch3: SUNRPC-Do-not-reuse-srcport-for-TIME_WAIT-socket.patch
Patch4: SUNRPC-xs_bind-uses-ip_local_reserved_ports.patch
Patch4: SUNRPC-xs_bind-uses-ip_local_reserved_ports_linux_rt.patch
Patch5: vsock-transport-for-9p.patch
Patch6: 4.18-x86-vmware-STA-support.patch
Patch7: 9p-trans_fd-extend-port-variable-to-u32.patch
Expand Down Expand Up @@ -855,5 +855,7 @@ ln -sf %{name}-%{uname_r}.cfg /boot/photon.cfg
/usr/src/%{name}-headers-%{uname_r}

%changelog
* Wed Dec 12 2019 Him Kalyan Bordoloi <bordoloih@vmware.com> 4.19.82-2
- Fix patch that wont apply on 4.19.82. Revert when upgraded to 4.19.87 or more
* Tue Nov 12 2019 Srivatsa S. Bhat (VMware) <srivatsa@csail.mit.edu> 4.19.82-1
- Introduce a new kernel flavor 'linux-rt' supporting real-time (RT) features.

0 comments on commit 8fba5e7

Please sign in to comment.