summaryrefslogtreecommitdiffstats
path: root/fs/afs
diff options
context:
space:
mode:
authorMarc Dionne <marc.dionne@auristor.com>2017-11-02 15:27:52 +0000
committerDavid Howells <dhowells@redhat.com>2017-11-13 15:38:20 +0000
commit83732ec5146916bd49b3036b0ea7dedb7831b90e (patch)
tree80f7fc2995f2b3be2adc6fe5170d1c2b08d96e20 /fs/afs
parentdab17c1add5c51b68027a9a3861af3a99cb5485a (diff)
downloadlinux-83732ec5146916bd49b3036b0ea7dedb7831b90e.tar.bz2
afs: Use a dynamic port if 7001 is in use
It is not required that the afs client operate on port 7001. The port could be in use because another kernel or userspace client has already bound to it. If the port is in use, just fallback to using a dynamic port. Signed-off-by: Marc Dionne <marc.dionne@auristor.com> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs')
-rw-r--r--fs/afs/rxrpc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c
index 06a51d70b82b..bd44ae8b63d8 100644
--- a/fs/afs/rxrpc.c
+++ b/fs/afs/rxrpc.c
@@ -61,6 +61,10 @@ int afs_open_socket(struct afs_net *net)
srx.transport.sin6.sin6_port = htons(AFS_CM_PORT);
ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx));
+ if (ret == -EADDRINUSE) {
+ srx.transport.sin6.sin6_port = 0;
+ ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx));
+ }
if (ret < 0)
goto error_2;