Patch "afs: Fix server list handling" has been added to the 4.15-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
afs: Fix server list handling
to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
afs-fix-server-list-handling.patch
and it can be found in the queue-4.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
45df8462730d2149834980d3db16e2d2b9daaf60Mon Sep 17 00:00:00 2001
From: David Howells <[email protected]>
Date: Tue, 6 Feb 2018 14:12:32 +0000
Subject: afs: Fix server list handling
From: David Howells <[email protected]>
commit 45df8462730d2149834980d3db16e2d2b9daaf60 upstream.
Fix server list handling in the following ways:
(1) In afs_alloc_volume(), remove duplicate server list build code. This was already done by afs_alloc_server_list() which afs_alloc_volume() previously called. This just results in twice as many VL RPCs.
(2) In afs_deliver_vl_get_entry_by_name_u(), use the number of server records indicated by ->nServers in the UVLDB record returned by the VL.GetEntryByNameU RPC call rather than scanning all NMAXNSERVERS slots. Unused slots may contain garbage.
(3) In afs_alloc_server_list(), don't stop converting a UVLDB record into a server list just because we can't look up one of the servers. Just skip that server and go on to the next. If we can't look up any of the servers then we'll fail at the end.
Without this patch, an attempt to view the umich.edu root cell using something like "ls /afs/umich.edu" on a dynamic root (future patch) mount or an autocell mount will result in ENOMEDIUM. The failure is due to kafs not stopping after nServers'worth of records have been read, but then trying to access a server with a garbage UUID and getting an error, which aborts the server list build.
--- fs/afs/server_list.c | 3 ++- fs/afs/vlclient.c | 10 +++++++--- fs/afs/volume.c | 46 ++-------------------------------------------- 3 files changed, 11 insertions(+), 48 deletions(-)
fs/afs/server_list.c +2 -1
@@ -58,7 +58,8 @@ struct afs_server_list *afs_alloc_server server =afs_lookup_server (cell, key, &vldb->fs_server[i]);if (IS_ERR (server)) { ret =PTR_ERR (server); -if (ret == -ENOENT ) +if (ret == -ENOENT || + ret == -ENOMEDIUM )continue ; goto error_2; }
fs/afs/vlclient.c +7 -3
@@ -23,7 +23,7 @@ static int afs_deliver_vl_get_entry_by_nstruct afs_uvldbentry__xdr *uvldb;struct afs_vldb_entry *entry;bool new_only = false; -u32 tmp; +u32 tmp, nr_servers;int i, ret;_enter ("" );
@@ -36,6 +36,10 @@ static int afs_deliver_vl_get_entry_by_n uvldb = call->buffer; entry = call->reply[0 ]; + nr_servers =ntohl (uvldb->nServers); +if (nr_servers >AFS_NMAXNSERVERS ) + nr_servers =AFS_NMAXNSERVERS ; +for (i =0 ; i <ARRAY_SIZE (uvldb->name) -1 ; i++) entry->name[i] = (u8 )ntohl (uvldb->name[i]); entry->name[i] =0 ;
@@ -44,14 +48,14 @@ static int afs_deliver_vl_get_entry_by_n/* If there is a new replication site that we can use, ignore all the * sites that aren't marked as new. */ -for (i =0 ; i <AFS_NMAXNSERVERS ; i++) { +for (i =0 ; i < nr_servers; i++) { tmp =ntohl (uvldb->serverFlags[i]);if (!(tmp &AFS_VLSF_DONTUSE ) && (tmp &AFS_VLSF_NEWREPSITE )) new_only = true; } -for (i =0 ; i <AFS_NMAXNSERVERS ; i++) { +for (i =0 ; i < nr_servers; i++) {struct afs_uuid__xdr *xdr;struct afs_uuid *uuid;int j;
fs/afs/volume.c +2 -44
67 lines not on this page · raw message
Patches currently in stable-queue which might be from [email protected] are
queue-4.15/afs-fix-missing-cursor-clearance.patch queue-4.15/afs-add-missing-afs_put_cell.patch queue-4.15/afs-need-to-clear-responded-flag-in-addr-cursor.patch queue-4.15/afs-fix-server-list-handling.patch