Skip to content

Commit 9483c37

Browse files
committed
Merge tag 'vfs-6.15-rc1.afs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull vfs afs updates from Christian Brauner: "This contains the work for afs for this cycle: - Fix an occasional hang that's only really encountered when rmmod'ing the kafs module - Remove the "-o autocell" mount option. This is obsolete with the dynamic root and removing it makes the next patch slightly easier - Change how the dynamic root mount is constructed. Currently, the root directory is (de)populated when it is (un)mounted if there are cells already configured and, further, pairs of automount points have to be created/removed each time a cell is added/deleted This is changed so that readdir on the root dir lists all the known cell automount pairs plus the @cell symlinks and the inodes and dentries are constructed by lookup on demand. This simplifies the cell management code - A few improvements to the afs_volume and afs_server tracepoints - Pass trace info into the afs_lookup_cell() function to allow the trace log to indicate the purpose of the lookup - Remove the 'net' parameter from afs_unuse_cell() as it's superfluous - In rxrpc, allow a kernel app (such as kafs) to store a word of information on rxrpc_peer records - Use the information stored on the rxrpc_peer record to point to the afs_server record. This allows the server address lookup to be done away with - Simplify the afs_server ref/activity accounting to make each one self-contained and not garbage collected from the cell management work item - Simplify the afs_cell ref/activity accounting to make each one of these also self-contained and not driven by a central management work item The current code was intended to make it such that a single timer for the namespace and one work item per cell could do all the work required to maintain these records. This, however, made for some sequencing problems when cleaning up these records. Further, the attempt to pass refs along with timers and work items made getting it right rather tricky when the timer or work item already had a ref attached and now a ref had to be got rid of" * tag 'vfs-6.15-rc1.afs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: afs: Simplify cell record handling afs: Fix afs_server ref accounting afs: Use the per-peer app data provided by rxrpc rxrpc: Allow the app to store private data on peer structs afs: Drop the net parameter from afs_unuse_cell() afs: Make afs_lookup_cell() take a trace note afs: Improve server refcount/active count tracing afs: Improve afs_volume tracing to display a debug ID afs: Change dynroot to create contents on demand afs: Remove the "autocell" mount option
2 parents c1c9830 + 58a5937 commit 9483c37

File tree

22 files changed

+906
-1104
lines changed

22 files changed

+906
-1104
lines changed

fs/afs/addr_list.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,3 +362,53 @@ int afs_merge_fs_addr6(struct afs_net *net, struct afs_addr_list *alist,
362362
alist->nr_addrs++;
363363
return 0;
364364
}
365+
366+
/*
367+
* Set the app data on the rxrpc peers an address list points to
368+
*/
369+
void afs_set_peer_appdata(struct afs_server *server,
370+
struct afs_addr_list *old_alist,
371+
struct afs_addr_list *new_alist)
372+
{
373+
unsigned long data = (unsigned long)server;
374+
int n = 0, o = 0;
375+
376+
if (!old_alist) {
377+
/* New server. Just set all. */
378+
for (; n < new_alist->nr_addrs; n++)
379+
rxrpc_kernel_set_peer_data(new_alist->addrs[n].peer, data);
380+
return;
381+
}
382+
if (!new_alist) {
383+
/* Dead server. Just remove all. */
384+
for (; o < old_alist->nr_addrs; o++)
385+
rxrpc_kernel_set_peer_data(old_alist->addrs[o].peer, 0);
386+
return;
387+
}
388+
389+
/* Walk through the two lists simultaneously, setting new peers and
390+
* clearing old ones. The two lists are ordered by pointer to peer
391+
* record.
392+
*/
393+
while (n < new_alist->nr_addrs && o < old_alist->nr_addrs) {
394+
struct rxrpc_peer *pn = new_alist->addrs[n].peer;
395+
struct rxrpc_peer *po = old_alist->addrs[o].peer;
396+
397+
if (pn == po)
398+
continue;
399+
if (pn < po) {
400+
rxrpc_kernel_set_peer_data(pn, data);
401+
n++;
402+
} else {
403+
rxrpc_kernel_set_peer_data(po, 0);
404+
o++;
405+
}
406+
}
407+
408+
if (n < new_alist->nr_addrs)
409+
for (; n < new_alist->nr_addrs; n++)
410+
rxrpc_kernel_set_peer_data(new_alist->addrs[n].peer, data);
411+
if (o < old_alist->nr_addrs)
412+
for (; o < old_alist->nr_addrs; o++)
413+
rxrpc_kernel_set_peer_data(old_alist->addrs[o].peer, 0);
414+
}

0 commit comments

Comments
 (0)