Commit 0c59ae12 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'afs-fix-rotation-20240105' of...

Merge tag 'afs-fix-rotation-20240105' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

Pull afs updates from David Howells:
 "The majority of the patches are aimed at fixing and improving the AFS
  filesystem's rotation over server IP addresses, but there are also
  some fixes from Oleg Nesterov for the use of read_seqbegin_or_lock().

   - Fix fileserver probe handling so that the next round of probes
     doesn't break ongoing server/address rotation by clearing all the
     probe result tracking. This could occasionally cause the rotation
     algorithm to drop straight through, give a 'successful' result
     without actually emitting any RPC calls, leaving the reply buffer
     in an undefined state.

     Instead, detach the probe results into a separate struct and
     allocate a new one each time we start probing and update the
     pointer to it. Probes are also sent in order of address preference
     to try and improve the chance that the preferred one will complete
     first.

   - Fix server rotation so that it uses configurable address
     preferences across on the probes that have completed so far than
     ranking them by RTT as the latter doesn't necessarily give the best
     route. The preference list can be altered by writing into
     /proc/net/afs/addr_prefs.

   - Fix the handling of Read-Only (and Backup) volume callbacks as
     there is one per volume, not one per file, so if someone performs a
     command that, say, offlines the volume but doesn't change it, when
     it comes back online we don't spam the server with a status fetch
     for every vnode we're using. Instead, check the Creation timestamp
     in the VolSync record when prompted by a callback break.

   - Handle volume regression (ie. a RW volume being restored from a
     backup) by scrubbing all cache data for that volume. This is
     detected from the VolSync creation timestamp.

   - Adjust abort handling and abort -> error mapping to match better
     with what other AFS clients do.

   - Fix offline and busy volume state handling as they only apply to
     individual server instances and not entire volumes and the rotation
     algorithm should go and look at other servers if available. Also
     make it sleep briefly before each retry if all the volume instances
     are unavailable"

* tag 'afs-fix-rotation-20240105' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: (40 commits)
  afs: trace: Log afs_make_call(), including server address
  afs: Fix offline and busy message emission
  afs: Fix fileserver rotation
  afs: Overhaul invalidation handling to better support RO volumes
  afs: Parse the VolSync record in the reply of a number of RPC ops
  afs: Don't leave DONTUSE/NEWREPSITE servers out of server list
  afs: Fix comment in afs_do_lookup()
  afs: Apply server breaks to mmap'd files in the call processor
  afs: Move the vnode/volume validity checking code into its own file
  afs: Defer volume record destruction to a workqueue
  afs: Make it possible to find the volumes that are using a server
  afs: Combine the endpoint state bools into a bitmask
  afs: Keep a record of the current fileserver endpoint state
  afs: Dispatch vlserver probes in priority order
  afs: Dispatch fileserver probes in priority order
  afs: Mark address lists with configured priorities
  afs: Provide a way to configure address priorities
  afs: Remove the unimplemented afs_cmp_addr_list()
  afs: Add some more info to /proc/net/afs/servers
  rxrpc: Create a procfile to display outstanding client conn bundles
  ...
parents 032500ab abcbd3bf
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
kafs-y := \ kafs-y := \
addr_list.o \ addr_list.o \
addr_prefs.o \
callback.o \ callback.o \
cell.o \ cell.o \
cmservice.o \ cmservice.o \
...@@ -27,6 +28,7 @@ kafs-y := \ ...@@ -27,6 +28,7 @@ kafs-y := \
server.o \ server.o \
server_list.o \ server_list.o \
super.o \ super.o \
validation.o \
vlclient.o \ vlclient.o \
vl_alias.o \ vl_alias.o \
vl_list.o \ vl_list.o \
......
...@@ -13,26 +13,55 @@ ...@@ -13,26 +13,55 @@
#include "internal.h" #include "internal.h"
#include "afs_fs.h" #include "afs_fs.h"
static void afs_free_addrlist(struct rcu_head *rcu)
{
struct afs_addr_list *alist = container_of(rcu, struct afs_addr_list, rcu);
unsigned int i;
for (i = 0; i < alist->nr_addrs; i++)
rxrpc_kernel_put_peer(alist->addrs[i].peer);
trace_afs_alist(alist->debug_id, refcount_read(&alist->usage), afs_alist_trace_free);
kfree(alist);
}
/* /*
* Release an address list. * Release an address list.
*/ */
void afs_put_addrlist(struct afs_addr_list *alist) void afs_put_addrlist(struct afs_addr_list *alist, enum afs_alist_trace reason)
{
unsigned int debug_id;
bool dead;
int r;
if (!alist)
return;
debug_id = alist->debug_id;
dead = __refcount_dec_and_test(&alist->usage, &r);
trace_afs_alist(debug_id, r - 1, reason);
if (dead)
call_rcu(&alist->rcu, afs_free_addrlist);
}
struct afs_addr_list *afs_get_addrlist(struct afs_addr_list *alist, enum afs_alist_trace reason)
{ {
if (alist && refcount_dec_and_test(&alist->usage)) int r;
kfree_rcu(alist, rcu);
if (alist) {
__refcount_inc(&alist->usage, &r);
trace_afs_alist(alist->debug_id, r + 1, reason);
}
return alist;
} }
/* /*
* Allocate an address list. * Allocate an address list.
*/ */
struct afs_addr_list *afs_alloc_addrlist(unsigned int nr, struct afs_addr_list *afs_alloc_addrlist(unsigned int nr)
unsigned short service,
unsigned short port)
{ {
struct afs_addr_list *alist; struct afs_addr_list *alist;
unsigned int i; static atomic_t debug_id;
_enter("%u,%u,%u", nr, service, port); _enter("%u", nr);
if (nr > AFS_MAX_ADDRESSES) if (nr > AFS_MAX_ADDRESSES)
nr = AFS_MAX_ADDRESSES; nr = AFS_MAX_ADDRESSES;
...@@ -43,17 +72,8 @@ struct afs_addr_list *afs_alloc_addrlist(unsigned int nr, ...@@ -43,17 +72,8 @@ struct afs_addr_list *afs_alloc_addrlist(unsigned int nr,
refcount_set(&alist->usage, 1); refcount_set(&alist->usage, 1);
alist->max_addrs = nr; alist->max_addrs = nr;
alist->debug_id = atomic_inc_return(&debug_id);
for (i = 0; i < nr; i++) { trace_afs_alist(alist->debug_id, 1, afs_alist_trace_alloc);
struct sockaddr_rxrpc *srx = &alist->addrs[i];
srx->srx_family = AF_RXRPC;
srx->srx_service = service;
srx->transport_type = SOCK_DGRAM;
srx->transport_len = sizeof(srx->transport.sin6);
srx->transport.sin6.sin6_family = AF_INET6;
srx->transport.sin6.sin6_port = htons(port);
}
return alist; return alist;
} }
...@@ -126,7 +146,7 @@ struct afs_vlserver_list *afs_parse_text_addrs(struct afs_net *net, ...@@ -126,7 +146,7 @@ struct afs_vlserver_list *afs_parse_text_addrs(struct afs_net *net,
if (!vllist->servers[0].server) if (!vllist->servers[0].server)
goto error_vl; goto error_vl;
alist = afs_alloc_addrlist(nr, service, AFS_VL_PORT); alist = afs_alloc_addrlist(nr);
if (!alist) if (!alist)
goto error; goto error;
...@@ -197,9 +217,11 @@ struct afs_vlserver_list *afs_parse_text_addrs(struct afs_net *net, ...@@ -197,9 +217,11 @@ struct afs_vlserver_list *afs_parse_text_addrs(struct afs_net *net,
} }
if (family == AF_INET) if (family == AF_INET)
afs_merge_fs_addr4(alist, x[0], xport); ret = afs_merge_fs_addr4(net, alist, x[0], xport);
else else
afs_merge_fs_addr6(alist, x, xport); ret = afs_merge_fs_addr6(net, alist, x, xport);
if (ret < 0)
goto error;
} while (p < end); } while (p < end);
...@@ -216,25 +238,12 @@ struct afs_vlserver_list *afs_parse_text_addrs(struct afs_net *net, ...@@ -216,25 +238,12 @@ struct afs_vlserver_list *afs_parse_text_addrs(struct afs_net *net,
problem, p - text, (int)len, (int)len, text); problem, p - text, (int)len, (int)len, text);
ret = -EINVAL; ret = -EINVAL;
error: error:
afs_put_addrlist(alist); afs_put_addrlist(alist, afs_alist_trace_put_parse_error);
error_vl: error_vl:
afs_put_vlserverlist(net, vllist); afs_put_vlserverlist(net, vllist);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
/*
* Compare old and new address lists to see if there's been any change.
* - How to do this in better than O(Nlog(N)) time?
* - We don't really want to sort the address list, but would rather take the
* list as we got it so as not to undo record rotation by the DNS server.
*/
#if 0
static int afs_cmp_addr_list(const struct afs_addr_list *a1,
const struct afs_addr_list *a2)
{
}
#endif
/* /*
* Perform a DNS query for VL servers and build a up an address list. * Perform a DNS query for VL servers and build a up an address list.
*/ */
...@@ -271,25 +280,33 @@ struct afs_vlserver_list *afs_dns_query(struct afs_cell *cell, time64_t *_expiry ...@@ -271,25 +280,33 @@ struct afs_vlserver_list *afs_dns_query(struct afs_cell *cell, time64_t *_expiry
/* /*
* Merge an IPv4 entry into a fileserver address list. * Merge an IPv4 entry into a fileserver address list.
*/ */
void afs_merge_fs_addr4(struct afs_addr_list *alist, __be32 xdr, u16 port) int afs_merge_fs_addr4(struct afs_net *net, struct afs_addr_list *alist,
__be32 xdr, u16 port)
{ {
struct sockaddr_rxrpc *srx; struct sockaddr_rxrpc srx;
u32 addr = ntohl(xdr); struct rxrpc_peer *peer;
int i; int i;
if (alist->nr_addrs >= alist->max_addrs) if (alist->nr_addrs >= alist->max_addrs)
return; return 0;
for (i = 0; i < alist->nr_ipv4; i++) { srx.srx_family = AF_RXRPC;
struct sockaddr_in *a = &alist->addrs[i].transport.sin; srx.transport_type = SOCK_DGRAM;
u32 a_addr = ntohl(a->sin_addr.s_addr); srx.transport_len = sizeof(srx.transport.sin);
u16 a_port = ntohs(a->sin_port); srx.transport.sin.sin_family = AF_INET;
srx.transport.sin.sin_port = htons(port);
srx.transport.sin.sin_addr.s_addr = xdr;
if (addr == a_addr && port == a_port) peer = rxrpc_kernel_lookup_peer(net->socket, &srx, GFP_KERNEL);
return; if (!peer)
if (addr == a_addr && port < a_port) return -ENOMEM;
break;
if (addr < a_addr) for (i = 0; i < alist->nr_ipv4; i++) {
if (peer == alist->addrs[i].peer) {
rxrpc_kernel_put_peer(peer);
return 0;
}
if (peer <= alist->addrs[i].peer)
break; break;
} }
...@@ -298,38 +315,42 @@ void afs_merge_fs_addr4(struct afs_addr_list *alist, __be32 xdr, u16 port) ...@@ -298,38 +315,42 @@ void afs_merge_fs_addr4(struct afs_addr_list *alist, __be32 xdr, u16 port)
alist->addrs + i, alist->addrs + i,
sizeof(alist->addrs[0]) * (alist->nr_addrs - i)); sizeof(alist->addrs[0]) * (alist->nr_addrs - i));
srx = &alist->addrs[i]; alist->addrs[i].peer = peer;
srx->srx_family = AF_RXRPC;
srx->transport_type = SOCK_DGRAM;
srx->transport_len = sizeof(srx->transport.sin);
srx->transport.sin.sin_family = AF_INET;
srx->transport.sin.sin_port = htons(port);
srx->transport.sin.sin_addr.s_addr = xdr;
alist->nr_ipv4++; alist->nr_ipv4++;
alist->nr_addrs++; alist->nr_addrs++;
return 0;
} }
/* /*
* Merge an IPv6 entry into a fileserver address list. * Merge an IPv6 entry into a fileserver address list.
*/ */
void afs_merge_fs_addr6(struct afs_addr_list *alist, __be32 *xdr, u16 port) int afs_merge_fs_addr6(struct afs_net *net, struct afs_addr_list *alist,
__be32 *xdr, u16 port)
{ {
struct sockaddr_rxrpc *srx; struct sockaddr_rxrpc srx;
int i, diff; struct rxrpc_peer *peer;
int i;
if (alist->nr_addrs >= alist->max_addrs) if (alist->nr_addrs >= alist->max_addrs)
return; return 0;
for (i = alist->nr_ipv4; i < alist->nr_addrs; i++) { srx.srx_family = AF_RXRPC;
struct sockaddr_in6 *a = &alist->addrs[i].transport.sin6; srx.transport_type = SOCK_DGRAM;
u16 a_port = ntohs(a->sin6_port); srx.transport_len = sizeof(srx.transport.sin6);
srx.transport.sin6.sin6_family = AF_INET6;
srx.transport.sin6.sin6_port = htons(port);
memcpy(&srx.transport.sin6.sin6_addr, xdr, 16);
diff = memcmp(xdr, &a->sin6_addr, 16); peer = rxrpc_kernel_lookup_peer(net->socket, &srx, GFP_KERNEL);
if (diff == 0 && port == a_port) if (!peer)
return; return -ENOMEM;
if (diff == 0 && port < a_port)
break; for (i = alist->nr_ipv4; i < alist->nr_addrs; i++) {
if (diff < 0) if (peer == alist->addrs[i].peer) {
rxrpc_kernel_put_peer(peer);
return 0;
}
if (peer <= alist->addrs[i].peer)
break; break;
} }
...@@ -337,68 +358,7 @@ void afs_merge_fs_addr6(struct afs_addr_list *alist, __be32 *xdr, u16 port) ...@@ -337,68 +358,7 @@ void afs_merge_fs_addr6(struct afs_addr_list *alist, __be32 *xdr, u16 port)
memmove(alist->addrs + i + 1, memmove(alist->addrs + i + 1,
alist->addrs + i, alist->addrs + i,
sizeof(alist->addrs[0]) * (alist->nr_addrs - i)); sizeof(alist->addrs[0]) * (alist->nr_addrs - i));
alist->addrs[i].peer = peer;
srx = &alist->addrs[i];
srx->srx_family = AF_RXRPC;
srx->transport_type = SOCK_DGRAM;
srx->transport_len = sizeof(srx->transport.sin6);
srx->transport.sin6.sin6_family = AF_INET6;
srx->transport.sin6.sin6_port = htons(port);
memcpy(&srx->transport.sin6.sin6_addr, xdr, 16);
alist->nr_addrs++; alist->nr_addrs++;
} return 0;
/*
* Get an address to try.
*/
bool afs_iterate_addresses(struct afs_addr_cursor *ac)
{
unsigned long set, failed;
int index;
if (!ac->alist)
return false;
set = ac->alist->responded;
failed = ac->alist->failed;
_enter("%lx-%lx-%lx,%d", set, failed, ac->tried, ac->index);
ac->nr_iterations++;
set &= ~(failed | ac->tried);
if (!set)
return false;
index = READ_ONCE(ac->alist->preferred);
if (test_bit(index, &set))
goto selected;
index = __ffs(set);
selected:
ac->index = index;
set_bit(index, &ac->tried);
ac->responded = false;
return true;
}
/*
* Release an address list cursor.
*/
int afs_end_cursor(struct afs_addr_cursor *ac)
{
struct afs_addr_list *alist;
alist = ac->alist;
if (alist) {
if (ac->responded &&
ac->index != alist->preferred &&
test_bit(ac->alist->preferred, &ac->tried))
WRITE_ONCE(alist->preferred, ac->index);
afs_put_addrlist(alist);
ac->alist = NULL;
}
return ac->error;
} }
This diff is collapsed.
...@@ -165,7 +165,8 @@ struct afs_status_cb { ...@@ -165,7 +165,8 @@ struct afs_status_cb {
* AFS volume synchronisation information * AFS volume synchronisation information
*/ */
struct afs_volsync { struct afs_volsync {
time64_t creation; /* volume creation time */ time64_t creation; /* Volume creation time (or TIME64_MIN) */
time64_t update; /* Volume update time (or TIME64_MIN) */
}; };
/* /*
......
...@@ -33,22 +33,20 @@ void afs_invalidate_mmap_work(struct work_struct *work) ...@@ -33,22 +33,20 @@ void afs_invalidate_mmap_work(struct work_struct *work)
unmap_mapping_pages(vnode->netfs.inode.i_mapping, 0, 0, false); unmap_mapping_pages(vnode->netfs.inode.i_mapping, 0, 0, false);
} }
void afs_server_init_callback_work(struct work_struct *work) static void afs_volume_init_callback(struct afs_volume *volume)
{ {
struct afs_server *server = container_of(work, struct afs_server, initcb_work);
struct afs_vnode *vnode; struct afs_vnode *vnode;
struct afs_cell *cell = server->cell;
down_read(&cell->fs_open_mmaps_lock); down_read(&volume->open_mmaps_lock);
list_for_each_entry(vnode, &cell->fs_open_mmaps, cb_mmap_link) { list_for_each_entry(vnode, &volume->open_mmaps, cb_mmap_link) {
if (vnode->cb_server == server) { if (vnode->cb_v_check != atomic_read(&volume->cb_v_break)) {
clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags); atomic64_set(&vnode->cb_expires_at, AFS_NO_CB_PROMISE);
queue_work(system_unbound_wq, &vnode->cb_work); queue_work(system_unbound_wq, &vnode->cb_work);
} }
} }
up_read(&cell->fs_open_mmaps_lock); up_read(&volume->open_mmaps_lock);
} }
/* /*
...@@ -57,15 +55,20 @@ void afs_server_init_callback_work(struct work_struct *work) ...@@ -57,15 +55,20 @@ void afs_server_init_callback_work(struct work_struct *work)
*/ */
void afs_init_callback_state(struct afs_server *server) void afs_init_callback_state(struct afs_server *server)
{ {
rcu_read_lock(); struct afs_server_entry *se;
do {
server->cb_s_break++;
atomic_inc(&server->cell->fs_s_break);
if (!list_empty(&server->cell->fs_open_mmaps))
queue_work(system_unbound_wq, &server->initcb_work);
} while ((server = rcu_dereference(server->uuid_next))); down_read(&server->cell->vs_lock);
rcu_read_unlock();
list_for_each_entry(se, &server->volumes, slink) {
se->cb_expires_at = AFS_NO_CB_PROMISE;
se->volume->cb_expires_at = AFS_NO_CB_PROMISE;
trace_afs_cb_v_break(se->volume->vid, atomic_read(&se->volume->cb_v_break),
afs_cb_break_for_s_reinit);
if (!list_empty(&se->volume->open_mmaps))
afs_volume_init_callback(se->volume);
}
up_read(&server->cell->vs_lock);
} }
/* /*
...@@ -76,9 +79,9 @@ void __afs_break_callback(struct afs_vnode *vnode, enum afs_cb_break_reason reas ...@@ -76,9 +79,9 @@ void __afs_break_callback(struct afs_vnode *vnode, enum afs_cb_break_reason reas
_enter(""); _enter("");
clear_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags); clear_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags);
if (test_and_clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) { if (atomic64_xchg(&vnode->cb_expires_at, AFS_NO_CB_PROMISE) != AFS_NO_CB_PROMISE) {
vnode->cb_break++; vnode->cb_break++;
vnode->cb_v_break = vnode->volume->cb_v_break; vnode->cb_v_check = atomic_read(&vnode->volume->cb_v_break);
afs_clear_permits(vnode); afs_clear_permits(vnode);
if (vnode->lock_state == AFS_VNODE_LOCK_WAITING_FOR_CB) if (vnode->lock_state == AFS_VNODE_LOCK_WAITING_FOR_CB)
...@@ -110,13 +113,14 @@ static struct afs_volume *afs_lookup_volume_rcu(struct afs_cell *cell, ...@@ -110,13 +113,14 @@ static struct afs_volume *afs_lookup_volume_rcu(struct afs_cell *cell,
{ {
struct afs_volume *volume = NULL; struct afs_volume *volume = NULL;
struct rb_node *p; struct rb_node *p;
int seq = 0; int seq = 1;
do { for (;;) {
/* Unfortunately, rbtree walking doesn't give reliable results /* Unfortunately, rbtree walking doesn't give reliable results
* under just the RCU read lock, so we have to check for * under just the RCU read lock, so we have to check for
* changes. * changes.
*/ */
seq++; /* 2 on the 1st/lockless path, otherwise odd */
read_seqbegin_or_lock(&cell->volume_lock, &seq); read_seqbegin_or_lock(&cell->volume_lock, &seq);
p = rcu_dereference_raw(cell->volumes.rb_node); p = rcu_dereference_raw(cell->volumes.rb_node);
...@@ -132,35 +136,63 @@ static struct afs_volume *afs_lookup_volume_rcu(struct afs_cell *cell, ...@@ -132,35 +136,63 @@ static struct afs_volume *afs_lookup_volume_rcu(struct afs_cell *cell,
volume = NULL; volume = NULL;
} }
} while (need_seqretry(&cell->volume_lock, seq)); if (volume && afs_try_get_volume(volume, afs_volume_trace_get_callback))
break;
if (!need_seqretry(&cell->volume_lock, seq))
break;
seq |= 1; /* Want a lock next time */
}
done_seqretry(&cell->volume_lock, seq); done_seqretry(&cell->volume_lock, seq);
return volume; return volume;
} }
/*
* Allow the fileserver to break callbacks at the volume-level. This is
* typically done when, for example, a R/W volume is snapshotted to a R/O
* volume (the only way to change an R/O volume). It may also, however, happen
* when a volserver takes control of a volume (offlining it, moving it, etc.).
*
* Every file in that volume will need to be reevaluated.
*/
static void afs_break_volume_callback(struct afs_server *server,
struct afs_volume *volume)
__releases(RCU)
{
struct afs_server_list *slist = rcu_dereference(volume->servers);
unsigned int i, cb_v_break;
write_lock(&volume->cb_v_break_lock);
for (i = 0; i < slist->nr_servers; i++)
if (slist->servers[i].server == server)
slist->servers[i].cb_expires_at = AFS_NO_CB_PROMISE;
volume->cb_expires_at = AFS_NO_CB_PROMISE;
cb_v_break = atomic_inc_return_release(&volume->cb_v_break);
trace_afs_cb_v_break(volume->vid, cb_v_break, afs_cb_break_for_volume_callback);
write_unlock(&volume->cb_v_break_lock);
rcu_read_unlock();
if (!list_empty(&volume->open_mmaps))
afs_volume_init_callback(volume);
}
/* /*
* allow the fileserver to explicitly break one callback * allow the fileserver to explicitly break one callback
* - happens when * - happens when
* - the backing file is changed * - the backing file is changed
* - a lock is released * - a lock is released
*/ */
static void afs_break_one_callback(struct afs_volume *volume, static void afs_break_one_callback(struct afs_server *server,
struct afs_volume *volume,
struct afs_fid *fid) struct afs_fid *fid)
{ {
struct super_block *sb; struct super_block *sb;
struct afs_vnode *vnode; struct afs_vnode *vnode;
struct inode *inode; struct inode *inode;
if (fid->vnode == 0 && fid->unique == 0) {
/* The callback break applies to an entire volume. */
write_lock(&volume->cb_v_break_lock);
volume->cb_v_break++;
trace_afs_cb_break(fid, volume->cb_v_break,
afs_cb_break_for_volume_callback, false);
write_unlock(&volume->cb_v_break_lock);
return;
}
/* See if we can find a matching inode - even an I_NEW inode needs to /* See if we can find a matching inode - even an I_NEW inode needs to
* be marked as it can have its callback broken before we finish * be marked as it can have its callback broken before we finish
* setting up the local inode. * setting up the local inode.
...@@ -187,25 +219,35 @@ static void afs_break_some_callbacks(struct afs_server *server, ...@@ -187,25 +219,35 @@ static void afs_break_some_callbacks(struct afs_server *server,
afs_volid_t vid = cbb->fid.vid; afs_volid_t vid = cbb->fid.vid;
size_t i; size_t i;
rcu_read_lock();
volume = afs_lookup_volume_rcu(server->cell, vid); volume = afs_lookup_volume_rcu(server->cell, vid);
if (cbb->fid.vnode == 0 && cbb->fid.unique == 0) {
afs_break_volume_callback(server, volume);
*_count -= 1;
if (*_count)
memmove(cbb, cbb + 1, sizeof(*cbb) * *_count);
} else {
/* TODO: Find all matching volumes if we couldn't match the server and
* break them anyway.
*/
/* TODO: Find all matching volumes if we couldn't match the server and for (i = *_count; i > 0; cbb++, i--) {
* break them anyway. if (cbb->fid.vid == vid) {
*/ _debug("- Fid { vl=%08llx n=%llu u=%u }",
cbb->fid.vid,
for (i = *_count; i > 0; cbb++, i--) { cbb->fid.vnode,
if (cbb->fid.vid == vid) { cbb->fid.unique);
_debug("- Fid { vl=%08llx n=%llu u=%u }", --*_count;
cbb->fid.vid, if (volume)
cbb->fid.vnode, afs_break_one_callback(server, volume, &cbb->fid);
cbb->fid.unique); } else {
--*_count; *residue++ = *cbb;
if (volume) }
afs_break_one_callback(volume, &cbb->fid);
} else {
*residue++ = *cbb;
} }
rcu_read_unlock();
} }
afs_put_volume(volume, afs_volume_trace_put_callback);
} }
/* /*
...@@ -218,11 +260,6 @@ void afs_break_callbacks(struct afs_server *server, size_t count, ...@@ -218,11 +260,6 @@ void afs_break_callbacks(struct afs_server *server, size_t count,
ASSERT(server != NULL); ASSERT(server != NULL);
rcu_read_lock();
while (count > 0) while (count > 0)
afs_break_some_callbacks(server, callbacks, &count); afs_break_some_callbacks(server, callbacks, &count);
rcu_read_unlock();
return;
} }
...@@ -161,13 +161,12 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net, ...@@ -161,13 +161,12 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net,
refcount_set(&cell->ref, 1); refcount_set(&cell->ref, 1);
atomic_set(&cell->active, 0); atomic_set(&cell->active, 0);
INIT_WORK(&cell->manager, afs_manage_cell_work); INIT_WORK(&cell->manager, afs_manage_cell_work);
init_rwsem(&cell->vs_lock);
cell->volumes = RB_ROOT; cell->volumes = RB_ROOT;
INIT_HLIST_HEAD(&cell->proc_volumes); INIT_HLIST_HEAD(&cell->proc_volumes);
seqlock_init(&cell->volume_lock); seqlock_init(&cell->volume_lock);
cell->fs_servers = RB_ROOT; cell->fs_servers = RB_ROOT;
seqlock_init(&cell->fs_lock); seqlock_init(&cell->fs_lock);
INIT_LIST_HEAD(&cell->fs_open_mmaps);
init_rwsem(&cell->fs_open_mmaps_lock);
rwlock_init(&cell->vl_servers_lock); rwlock_init(&cell->vl_servers_lock);
cell->flags = (1 << AFS_CELL_FL_CHECK_ALIAS); cell->flags = (1 << AFS_CELL_FL_CHECK_ALIAS);
...@@ -817,7 +816,7 @@ static void afs_manage_cell(struct afs_cell *cell) ...@@ -817,7 +816,7 @@ static void afs_manage_cell(struct afs_cell *cell)
final_destruction: final_destruction:
/* The root volume is pinning the cell */ /* The root volume is pinning the cell */
afs_put_volume(cell->net, cell->root_volume, afs_volume_trace_put_cell_root); afs_put_volume(cell->root_volume, afs_volume_trace_put_cell_root);
cell->root_volume = NULL; cell->root_volume = NULL;
afs_put_cell(cell, afs_cell_trace_put_destroy); afs_put_cell(cell, afs_cell_trace_put_destroy);
} }
......
...@@ -146,10 +146,11 @@ static int afs_find_cm_server_by_peer(struct afs_call *call) ...@@ -146,10 +146,11 @@ static int afs_find_cm_server_by_peer(struct afs_call *call)
{ {
struct sockaddr_rxrpc srx; struct sockaddr_rxrpc srx;
struct afs_server *server; struct afs_server *server;
struct rxrpc_peer *peer;
rxrpc_kernel_get_peer(call->net->socket, call->rxcall, &srx); peer = rxrpc_kernel_get_call_peer(call->net->socket, call->rxcall);
server = afs_find_server(call->net, &srx); server = afs_find_server(call->net, peer);
if (!server) { if (!server) {
trace_afs_cm_no_server(call, &srx); trace_afs_cm_no_server(call, &srx);
return 0; return 0;
......
...@@ -693,8 +693,9 @@ static void afs_do_lookup_success(struct afs_operation *op) ...@@ -693,8 +693,9 @@ static void afs_do_lookup_success(struct afs_operation *op)
vp = &op->file[0]; vp = &op->file[0];
abort_code = vp->scb.status.abort_code; abort_code = vp->scb.status.abort_code;
if (abort_code != 0) { if (abort_code != 0) {
op->ac.abort_code = abort_code; op->call_abort_code = abort_code;
op->error = afs_abort_to_error(abort_code); afs_op_set_error(op, afs_abort_to_error(abort_code));
op->cumul_error.abort_code = abort_code;
} }
break; break;
...@@ -806,8 +807,8 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry, ...@@ -806,8 +807,8 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
cookie->fids[i].vid = dvnode->fid.vid; cookie->fids[i].vid = dvnode->fid.vid;
cookie->ctx.actor = afs_lookup_filldir; cookie->ctx.actor = afs_lookup_filldir;
cookie->name = dentry->d_name; cookie->name = dentry->d_name;
cookie->nr_fids = 2; /* slot 0 is saved for the fid we actually want cookie->nr_fids = 2; /* slot 1 is saved for the fid we actually want
* and slot 1 for the directory */ * and slot 0 for the directory */
if (!afs_server_supports_ibulk(dvnode)) if (!afs_server_supports_ibulk(dvnode))
cookie->one_only = true; cookie->one_only = true;
...@@ -846,13 +847,14 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry, ...@@ -846,13 +847,14 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
_debug("nr_files %u", op->nr_files); _debug("nr_files %u", op->nr_files);
/* Need space for examining all the selected files */ /* Need space for examining all the selected files */
op->error = -ENOMEM;
if (op->nr_files > 2) { if (op->nr_files > 2) {
op->more_files = kvcalloc(op->nr_files - 2, op->more_files = kvcalloc(op->nr_files - 2,
sizeof(struct afs_vnode_param), sizeof(struct afs_vnode_param),
GFP_KERNEL); GFP_KERNEL);
if (!op->more_files) if (!op->more_files) {
afs_op_nomem(op);
goto out_op; goto out_op;
}
for (i = 2; i < op->nr_files; i++) { for (i = 2; i < op->nr_files; i++) {
vp = &op->more_files[i - 2]; vp = &op->more_files[i - 2];
...@@ -878,14 +880,14 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry, ...@@ -878,14 +880,14 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
* lookups contained therein are stored in the reply without aborting * lookups contained therein are stored in the reply without aborting
* the whole operation. * the whole operation.
*/ */
op->error = -ENOTSUPP; afs_op_set_error(op, -ENOTSUPP);
if (!cookie->one_only) { if (!cookie->one_only) {
op->ops = &afs_inline_bulk_status_operation; op->ops = &afs_inline_bulk_status_operation;
afs_begin_vnode_operation(op); afs_begin_vnode_operation(op);
afs_wait_for_operation(op); afs_wait_for_operation(op);
} }
if (op->error == -ENOTSUPP) { if (afs_op_error(op) == -ENOTSUPP) {
/* We could try FS.BulkStatus next, but this aborts the entire /* We could try FS.BulkStatus next, but this aborts the entire
* op if any of the lookups fails - so, for the moment, revert * op if any of the lookups fails - so, for the moment, revert
* to FS.FetchStatus for op->file[1]. * to FS.FetchStatus for op->file[1].
...@@ -895,10 +897,10 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry, ...@@ -895,10 +897,10 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
afs_begin_vnode_operation(op); afs_begin_vnode_operation(op);
afs_wait_for_operation(op); afs_wait_for_operation(op);
} }
inode = ERR_PTR(op->error); inode = ERR_PTR(afs_op_error(op));
out_op: out_op:
if (op->error == 0) { if (!afs_op_error(op)) {
inode = &op->file[1].vnode->netfs.inode; inode = &op->file[1].vnode->netfs.inode;
op->file[1].vnode = NULL; op->file[1].vnode = NULL;
} }
...@@ -1116,7 +1118,12 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) ...@@ -1116,7 +1118,12 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
dir = AFS_FS_I(d_inode(parent)); dir = AFS_FS_I(d_inode(parent));
/* validate the parent directory */ /* validate the parent directory */
afs_validate(dir, key); ret = afs_validate(dir, key);
if (ret == -ERESTARTSYS) {
dput(parent);
key_put(key);
return ret;
}
if (test_bit(AFS_VNODE_DELETED, &dir->flags)) { if (test_bit(AFS_VNODE_DELETED, &dir->flags)) {
_debug("%pd: parent dir deleted", dentry); _debug("%pd: parent dir deleted", dentry);
...@@ -1255,9 +1262,10 @@ void afs_check_for_remote_deletion(struct afs_operation *op) ...@@ -1255,9 +1262,10 @@ void afs_check_for_remote_deletion(struct afs_operation *op)
{ {
struct afs_vnode *vnode = op->file[0].vnode; struct afs_vnode *vnode = op->file[0].vnode;
switch (op->ac.abort_code) { switch (afs_op_abort_code(op)) {
case VNOVNODE: case VNOVNODE:
set_bit(AFS_VNODE_DELETED, &vnode->flags); set_bit(AFS_VNODE_DELETED, &vnode->flags);
clear_nlink(&vnode->netfs.inode);
afs_break_callback(vnode, afs_cb_break_for_deleted); afs_break_callback(vnode, afs_cb_break_for_deleted);
} }
} }
...@@ -1273,20 +1281,20 @@ static void afs_vnode_new_inode(struct afs_operation *op) ...@@ -1273,20 +1281,20 @@ static void afs_vnode_new_inode(struct afs_operation *op)
_enter(""); _enter("");
ASSERTCMP(op->error, ==, 0); ASSERTCMP(afs_op_error(op), ==, 0);
inode = afs_iget(op, vp); inode = afs_iget(op, vp);
if (IS_ERR(inode)) { if (IS_ERR(inode)) {
/* ENOMEM or EINTR at a really inconvenient time - just abandon /* ENOMEM or EINTR at a really inconvenient time - just abandon
* the new directory on the server. * the new directory on the server.
*/ */
op->error = PTR_ERR(inode); afs_op_accumulate_error(op, PTR_ERR(inode), 0);
return; return;
} }
vnode = AFS_FS_I(inode); vnode = AFS_FS_I(inode);
set_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags); set_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags);
if (!op->error) if (!afs_op_error(op))
afs_cache_permit(vnode, op->key, vnode->cb_break, &vp->scb); afs_cache_permit(vnode, op->key, vnode->cb_break, &vp->scb);
d_instantiate(op->dentry, inode); d_instantiate(op->dentry, inode);
} }
...@@ -1320,7 +1328,7 @@ static void afs_create_put(struct afs_operation *op) ...@@ -1320,7 +1328,7 @@ static void afs_create_put(struct afs_operation *op)
{ {
_enter("op=%08x", op->debug_id); _enter("op=%08x", op->debug_id);
if (op->error) if (afs_op_error(op))
d_drop(op->dentry); d_drop(op->dentry);
} }
...@@ -1373,7 +1381,7 @@ static void afs_dir_remove_subdir(struct dentry *dentry) ...@@ -1373,7 +1381,7 @@ static void afs_dir_remove_subdir(struct dentry *dentry)
clear_nlink(&vnode->netfs.inode); clear_nlink(&vnode->netfs.inode);
set_bit(AFS_VNODE_DELETED, &vnode->flags); set_bit(AFS_VNODE_DELETED, &vnode->flags);
clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags); atomic64_set(&vnode->cb_expires_at, AFS_NO_CB_PROMISE);
clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags); clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags);
} }
} }
...@@ -1480,7 +1488,7 @@ static void afs_dir_remove_link(struct afs_operation *op) ...@@ -1480,7 +1488,7 @@ static void afs_dir_remove_link(struct afs_operation *op)
struct dentry *dentry = op->dentry; struct dentry *dentry = op->dentry;
int ret; int ret;
if (op->error != 0 || if (afs_op_error(op) ||
(op->file[1].scb.have_status && op->file[1].scb.have_error)) (op->file[1].scb.have_status && op->file[1].scb.have_error))
return; return;
if (d_really_is_positive(dentry)) if (d_really_is_positive(dentry))
...@@ -1504,10 +1512,10 @@ static void afs_dir_remove_link(struct afs_operation *op) ...@@ -1504,10 +1512,10 @@ static void afs_dir_remove_link(struct afs_operation *op)
ret = afs_validate(vnode, op->key); ret = afs_validate(vnode, op->key);
if (ret != -ESTALE) if (ret != -ESTALE)
op->error = ret; afs_op_set_error(op, ret);
} }
_debug("nlink %d [val %d]", vnode->netfs.inode.i_nlink, op->error); _debug("nlink %d [val %d]", vnode->netfs.inode.i_nlink, afs_op_error(op));
} }
static void afs_unlink_success(struct afs_operation *op) static void afs_unlink_success(struct afs_operation *op)
...@@ -1538,7 +1546,7 @@ static void afs_unlink_edit_dir(struct afs_operation *op) ...@@ -1538,7 +1546,7 @@ static void afs_unlink_edit_dir(struct afs_operation *op)
static void afs_unlink_put(struct afs_operation *op) static void afs_unlink_put(struct afs_operation *op)
{ {
_enter("op=%08x", op->debug_id); _enter("op=%08x", op->debug_id);
if (op->unlink.need_rehash && op->error < 0 && op->error != -ENOENT) if (op->unlink.need_rehash && afs_op_error(op) < 0 && afs_op_error(op) != -ENOENT)
d_rehash(op->dentry); d_rehash(op->dentry);
} }
...@@ -1579,7 +1587,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -1579,7 +1587,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
/* Try to make sure we have a callback promise on the victim. */ /* Try to make sure we have a callback promise on the victim. */
ret = afs_validate(vnode, op->key); ret = afs_validate(vnode, op->key);
if (ret < 0) { if (ret < 0) {
op->error = ret; afs_op_set_error(op, ret);
goto error; goto error;
} }
...@@ -1588,7 +1596,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -1588,7 +1596,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
/* Start asynchronous writeout of the inode */ /* Start asynchronous writeout of the inode */
write_inode_now(d_inode(dentry), 0); write_inode_now(d_inode(dentry), 0);
op->error = afs_sillyrename(dvnode, vnode, dentry, op->key); afs_op_set_error(op, afs_sillyrename(dvnode, vnode, dentry, op->key));
goto error; goto error;
} }
if (!d_unhashed(dentry)) { if (!d_unhashed(dentry)) {
...@@ -1609,7 +1617,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -1609,7 +1617,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
/* If there was a conflict with a third party, check the status of the /* If there was a conflict with a third party, check the status of the
* unlinked vnode. * unlinked vnode.
*/ */
if (op->error == 0 && (op->flags & AFS_OPERATION_DIR_CONFLICT)) { if (afs_op_error(op) == 0 && (op->flags & AFS_OPERATION_DIR_CONFLICT)) {
op->file[1].update_ctime = false; op->file[1].update_ctime = false;
op->fetch_status.which = 1; op->fetch_status.which = 1;
op->ops = &afs_fetch_status_operation; op->ops = &afs_fetch_status_operation;
...@@ -1691,7 +1699,7 @@ static void afs_link_success(struct afs_operation *op) ...@@ -1691,7 +1699,7 @@ static void afs_link_success(struct afs_operation *op)
static void afs_link_put(struct afs_operation *op) static void afs_link_put(struct afs_operation *op)
{ {
_enter("op=%08x", op->debug_id); _enter("op=%08x", op->debug_id);
if (op->error) if (afs_op_error(op))
d_drop(op->dentry); d_drop(op->dentry);
} }
...@@ -1889,7 +1897,7 @@ static void afs_rename_put(struct afs_operation *op) ...@@ -1889,7 +1897,7 @@ static void afs_rename_put(struct afs_operation *op)
if (op->rename.rehash) if (op->rename.rehash)
d_rehash(op->rename.rehash); d_rehash(op->rename.rehash);
dput(op->rename.tmp); dput(op->rename.tmp);
if (op->error) if (afs_op_error(op))
d_rehash(op->dentry); d_rehash(op->dentry);
} }
...@@ -1934,7 +1942,7 @@ static int afs_rename(struct mnt_idmap *idmap, struct inode *old_dir, ...@@ -1934,7 +1942,7 @@ static int afs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
return PTR_ERR(op); return PTR_ERR(op);
ret = afs_validate(vnode, op->key); ret = afs_validate(vnode, op->key);
op->error = ret; afs_op_set_error(op, ret);
if (ret < 0) if (ret < 0)
goto error; goto error;
...@@ -1971,7 +1979,7 @@ static int afs_rename(struct mnt_idmap *idmap, struct inode *old_dir, ...@@ -1971,7 +1979,7 @@ static int afs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
op->rename.tmp = d_alloc(new_dentry->d_parent, op->rename.tmp = d_alloc(new_dentry->d_parent,
&new_dentry->d_name); &new_dentry->d_name);
if (!op->rename.tmp) { if (!op->rename.tmp) {
op->error = -ENOMEM; afs_op_nomem(op);
goto error; goto error;
} }
...@@ -1979,7 +1987,7 @@ static int afs_rename(struct mnt_idmap *idmap, struct inode *old_dir, ...@@ -1979,7 +1987,7 @@ static int afs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
AFS_FS_I(d_inode(new_dentry)), AFS_FS_I(d_inode(new_dentry)),
new_dentry, op->key); new_dentry, op->key);
if (ret) { if (ret) {
op->error = ret; afs_op_set_error(op, ret);
goto error; goto error;
} }
......
...@@ -218,7 +218,7 @@ static int afs_do_silly_unlink(struct afs_vnode *dvnode, struct afs_vnode *vnode ...@@ -218,7 +218,7 @@ static int afs_do_silly_unlink(struct afs_vnode *dvnode, struct afs_vnode *vnode
/* If there was a conflict with a third party, check the status of the /* If there was a conflict with a third party, check the status of the
* unlinked vnode. * unlinked vnode.
*/ */
if (op->error == 0 && (op->flags & AFS_OPERATION_DIR_CONFLICT)) { if (op->cumul_error.error == 0 && (op->flags & AFS_OPERATION_DIR_CONFLICT)) {
op->file[1].update_ctime = false; op->file[1].update_ctime = false;
op->fetch_status.which = 1; op->fetch_status.which = 1;
op->ops = &afs_fetch_status_operation; op->ops = &afs_fetch_status_operation;
......
...@@ -243,12 +243,9 @@ static void afs_fetch_data_notify(struct afs_operation *op) ...@@ -243,12 +243,9 @@ static void afs_fetch_data_notify(struct afs_operation *op)
{ {
struct afs_read *req = op->fetch.req; struct afs_read *req = op->fetch.req;
struct netfs_io_subrequest *subreq = req->subreq; struct netfs_io_subrequest *subreq = req->subreq;
int error = op->error; int error = afs_op_error(op);
if (error == -ECONNABORTED)
error = afs_abort_to_error(op->ac.abort_code);
req->error = error; req->error = error;
if (subreq) { if (subreq) {
__set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags); __set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags);
netfs_subreq_terminated(subreq, error ?: req->actual_len, false); netfs_subreq_terminated(subreq, error ?: req->actual_len, false);
...@@ -271,7 +268,7 @@ static void afs_fetch_data_success(struct afs_operation *op) ...@@ -271,7 +268,7 @@ static void afs_fetch_data_success(struct afs_operation *op)
static void afs_fetch_data_put(struct afs_operation *op) static void afs_fetch_data_put(struct afs_operation *op)
{ {
op->fetch.req->error = op->error; op->fetch.req->error = afs_op_error(op);
afs_put_read(op->fetch.req); afs_put_read(op->fetch.req);
} }
...@@ -517,13 +514,12 @@ static bool afs_release_folio(struct folio *folio, gfp_t gfp) ...@@ -517,13 +514,12 @@ static bool afs_release_folio(struct folio *folio, gfp_t gfp)
static void afs_add_open_mmap(struct afs_vnode *vnode) static void afs_add_open_mmap(struct afs_vnode *vnode)
{ {
if (atomic_inc_return(&vnode->cb_nr_mmap) == 1) { if (atomic_inc_return(&vnode->cb_nr_mmap) == 1) {
down_write(&vnode->volume->cell->fs_open_mmaps_lock); down_write(&vnode->volume->open_mmaps_lock);
if (list_empty(&vnode->cb_mmap_link)) if (list_empty(&vnode->cb_mmap_link))
list_add_tail(&vnode->cb_mmap_link, list_add_tail(&vnode->cb_mmap_link, &vnode->volume->open_mmaps);
&vnode->volume->cell->fs_open_mmaps);
up_write(&vnode->volume->cell->fs_open_mmaps_lock); up_write(&vnode->volume->open_mmaps_lock);
} }
} }
...@@ -532,12 +528,12 @@ static void afs_drop_open_mmap(struct afs_vnode *vnode) ...@@ -532,12 +528,12 @@ static void afs_drop_open_mmap(struct afs_vnode *vnode)
if (!atomic_dec_and_test(&vnode->cb_nr_mmap)) if (!atomic_dec_and_test(&vnode->cb_nr_mmap))
return; return;
down_write(&vnode->volume->cell->fs_open_mmaps_lock); down_write(&vnode->volume->open_mmaps_lock);
if (atomic_read(&vnode->cb_nr_mmap) == 0) if (atomic_read(&vnode->cb_nr_mmap) == 0)
list_del_init(&vnode->cb_mmap_link); list_del_init(&vnode->cb_mmap_link);
up_write(&vnode->volume->cell->fs_open_mmaps_lock); up_write(&vnode->volume->open_mmaps_lock);
flush_work(&vnode->cb_work); flush_work(&vnode->cb_work);
} }
...@@ -573,7 +569,7 @@ static vm_fault_t afs_vm_map_pages(struct vm_fault *vmf, pgoff_t start_pgoff, pg ...@@ -573,7 +569,7 @@ static vm_fault_t afs_vm_map_pages(struct vm_fault *vmf, pgoff_t start_pgoff, pg
{ {
struct afs_vnode *vnode = AFS_FS_I(file_inode(vmf->vma->vm_file)); struct afs_vnode *vnode = AFS_FS_I(file_inode(vmf->vma->vm_file));
if (afs_pagecache_valid(vnode)) if (afs_check_validity(vnode))
return filemap_map_pages(vmf, start_pgoff, end_pgoff); return filemap_map_pages(vmf, start_pgoff, end_pgoff);
return 0; return 0;
} }
......
...@@ -35,13 +35,15 @@ struct afs_operation *afs_alloc_operation(struct key *key, struct afs_volume *vo ...@@ -35,13 +35,15 @@ struct afs_operation *afs_alloc_operation(struct key *key, struct afs_volume *vo
key_get(key); key_get(key);
} }
op->key = key; op->key = key;
op->volume = afs_get_volume(volume, afs_volume_trace_get_new_op); op->volume = afs_get_volume(volume, afs_volume_trace_get_new_op);
op->net = volume->cell->net; op->net = volume->cell->net;
op->cb_v_break = volume->cb_v_break; op->cb_v_break = atomic_read(&volume->cb_v_break);
op->debug_id = atomic_inc_return(&afs_operation_debug_counter); op->pre_volsync.creation = volume->creation_time;
op->error = -EDESTADDRREQ; op->pre_volsync.update = volume->update_time;
op->ac.error = SHRT_MAX; op->debug_id = atomic_inc_return(&afs_operation_debug_counter);
op->nr_iterations = -1;
afs_op_set_error(op, -EDESTADDRREQ);
_leave(" = [op=%08x]", op->debug_id); _leave(" = [op=%08x]", op->debug_id);
return op; return op;
...@@ -71,7 +73,7 @@ static bool afs_get_io_locks(struct afs_operation *op) ...@@ -71,7 +73,7 @@ static bool afs_get_io_locks(struct afs_operation *op)
swap(vnode, vnode2); swap(vnode, vnode2);
if (mutex_lock_interruptible(&vnode->io_lock) < 0) { if (mutex_lock_interruptible(&vnode->io_lock) < 0) {
op->error = -ERESTARTSYS; afs_op_set_error(op, -ERESTARTSYS);
op->flags |= AFS_OPERATION_STOP; op->flags |= AFS_OPERATION_STOP;
_leave(" = f [I 0]"); _leave(" = f [I 0]");
return false; return false;
...@@ -80,7 +82,7 @@ static bool afs_get_io_locks(struct afs_operation *op) ...@@ -80,7 +82,7 @@ static bool afs_get_io_locks(struct afs_operation *op)
if (vnode2) { if (vnode2) {
if (mutex_lock_interruptible_nested(&vnode2->io_lock, 1) < 0) { if (mutex_lock_interruptible_nested(&vnode2->io_lock, 1) < 0) {
op->error = -ERESTARTSYS; afs_op_set_error(op, -ERESTARTSYS);
op->flags |= AFS_OPERATION_STOP; op->flags |= AFS_OPERATION_STOP;
mutex_unlock(&vnode->io_lock); mutex_unlock(&vnode->io_lock);
op->flags &= ~AFS_OPERATION_LOCK_0; op->flags &= ~AFS_OPERATION_LOCK_0;
...@@ -147,7 +149,7 @@ bool afs_begin_vnode_operation(struct afs_operation *op) ...@@ -147,7 +149,7 @@ bool afs_begin_vnode_operation(struct afs_operation *op)
afs_prepare_vnode(op, &op->file[0], 0); afs_prepare_vnode(op, &op->file[0], 0);
afs_prepare_vnode(op, &op->file[1], 1); afs_prepare_vnode(op, &op->file[1], 1);
op->cb_v_break = op->volume->cb_v_break; op->cb_v_break = atomic_read(&op->volume->cb_v_break);
_leave(" = true"); _leave(" = true");
return true; return true;
} }
...@@ -159,16 +161,16 @@ static void afs_end_vnode_operation(struct afs_operation *op) ...@@ -159,16 +161,16 @@ static void afs_end_vnode_operation(struct afs_operation *op)
{ {
_enter(""); _enter("");
if (op->error == -EDESTADDRREQ || switch (afs_op_error(op)) {
op->error == -EADDRNOTAVAIL || case -EDESTADDRREQ:
op->error == -ENETUNREACH || case -EADDRNOTAVAIL:
op->error == -EHOSTUNREACH) case -ENETUNREACH:
case -EHOSTUNREACH:
afs_dump_edestaddrreq(op); afs_dump_edestaddrreq(op);
break;
}
afs_drop_io_locks(op); afs_drop_io_locks(op);
if (op->error == -ECONNABORTED)
op->error = afs_abort_to_error(op->ac.abort_code);
} }
/* /*
...@@ -179,37 +181,43 @@ void afs_wait_for_operation(struct afs_operation *op) ...@@ -179,37 +181,43 @@ void afs_wait_for_operation(struct afs_operation *op)
_enter(""); _enter("");
while (afs_select_fileserver(op)) { while (afs_select_fileserver(op)) {
op->cb_s_break = op->server->cb_s_break; op->call_responded = false;
op->call_error = 0;
op->call_abort_code = 0;
if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) && if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) &&
op->ops->issue_yfs_rpc) op->ops->issue_yfs_rpc)
op->ops->issue_yfs_rpc(op); op->ops->issue_yfs_rpc(op);
else if (op->ops->issue_afs_rpc) else if (op->ops->issue_afs_rpc)
op->ops->issue_afs_rpc(op); op->ops->issue_afs_rpc(op);
else else
op->ac.error = -ENOTSUPP; op->call_error = -ENOTSUPP;
if (op->call) if (op->call) {
op->error = afs_wait_for_call_to_complete(op->call, &op->ac); afs_wait_for_call_to_complete(op->call);
op->call_abort_code = op->call->abort_code;
op->call_error = op->call->error;
op->call_responded = op->call->responded;
afs_put_call(op->call);
}
} }
switch (op->error) { if (op->call_responded)
case 0: set_bit(AFS_SERVER_FL_RESPONDING, &op->server->flags);
if (!afs_op_error(op)) {
_debug("success"); _debug("success");
op->ops->success(op); op->ops->success(op);
break; } else if (op->cumul_error.aborted) {
case -ECONNABORTED:
if (op->ops->aborted) if (op->ops->aborted)
op->ops->aborted(op); op->ops->aborted(op);
fallthrough; } else {
default:
if (op->ops->failed) if (op->ops->failed)
op->ops->failed(op); op->ops->failed(op);
break;
} }
afs_end_vnode_operation(op); afs_end_vnode_operation(op);
if (op->error == 0 && op->ops->edit_dir) { if (!afs_op_error(op) && op->ops->edit_dir) {
_debug("edit_dir"); _debug("edit_dir");
op->ops->edit_dir(op); op->ops->edit_dir(op);
} }
...@@ -221,7 +229,8 @@ void afs_wait_for_operation(struct afs_operation *op) ...@@ -221,7 +229,8 @@ void afs_wait_for_operation(struct afs_operation *op)
*/ */
int afs_put_operation(struct afs_operation *op) int afs_put_operation(struct afs_operation *op)
{ {
int i, ret = op->error; struct afs_addr_list *alist;
int i, ret = afs_op_error(op);
_enter("op=%08x,%d", op->debug_id, ret); _enter("op=%08x,%d", op->debug_id, ret);
...@@ -243,9 +252,19 @@ int afs_put_operation(struct afs_operation *op) ...@@ -243,9 +252,19 @@ int afs_put_operation(struct afs_operation *op)
kfree(op->more_files); kfree(op->more_files);
} }
afs_end_cursor(&op->ac); if (op->estate) {
alist = op->estate->addresses;
if (alist) {
if (op->call_responded &&
op->addr_index != alist->preferred &&
test_bit(alist->preferred, &op->addr_tried))
WRITE_ONCE(alist->preferred, op->addr_index);
}
}
afs_clear_server_states(op);
afs_put_serverlist(op->net, op->server_list); afs_put_serverlist(op->net, op->server_list);
afs_put_volume(op->net, op->volume, afs_volume_trace_put_put_op); afs_put_volume(op->volume, afs_volume_trace_put_put_op);
key_put(op->key); key_put(op->key);
kfree(op); kfree(op);
return ret; return ret;
......
This diff is collapsed.
...@@ -290,6 +290,7 @@ void afs_fs_fetch_status(struct afs_operation *op) ...@@ -290,6 +290,7 @@ void afs_fs_fetch_status(struct afs_operation *op)
bp[2] = htonl(vp->fid.vnode); bp[2] = htonl(vp->fid.vnode);
bp[3] = htonl(vp->fid.unique); bp[3] = htonl(vp->fid.unique);
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -442,6 +443,7 @@ static void afs_fs_fetch_data64(struct afs_operation *op) ...@@ -442,6 +443,7 @@ static void afs_fs_fetch_data64(struct afs_operation *op)
bp[6] = 0; bp[6] = 0;
bp[7] = htonl(lower_32_bits(req->len)); bp[7] = htonl(lower_32_bits(req->len));
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -476,6 +478,7 @@ void afs_fs_fetch_data(struct afs_operation *op) ...@@ -476,6 +478,7 @@ void afs_fs_fetch_data(struct afs_operation *op)
bp[4] = htonl(lower_32_bits(req->pos)); bp[4] = htonl(lower_32_bits(req->pos));
bp[5] = htonl(lower_32_bits(req->len)); bp[5] = htonl(lower_32_bits(req->len));
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -559,6 +562,7 @@ void afs_fs_create_file(struct afs_operation *op) ...@@ -559,6 +562,7 @@ void afs_fs_create_file(struct afs_operation *op)
*bp++ = htonl(op->create.mode & S_IALLUGO); /* unix mode */ *bp++ = htonl(op->create.mode & S_IALLUGO); /* unix mode */
*bp++ = 0; /* segment size */ *bp++ = 0; /* segment size */
call->fid = dvp->fid;
trace_afs_make_fs_call1(call, &dvp->fid, name); trace_afs_make_fs_call1(call, &dvp->fid, name);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -612,6 +616,7 @@ void afs_fs_make_dir(struct afs_operation *op) ...@@ -612,6 +616,7 @@ void afs_fs_make_dir(struct afs_operation *op)
*bp++ = htonl(op->create.mode & S_IALLUGO); /* unix mode */ *bp++ = htonl(op->create.mode & S_IALLUGO); /* unix mode */
*bp++ = 0; /* segment size */ *bp++ = 0; /* segment size */
call->fid = dvp->fid;
trace_afs_make_fs_call1(call, &dvp->fid, name); trace_afs_make_fs_call1(call, &dvp->fid, name);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -685,6 +690,7 @@ void afs_fs_remove_file(struct afs_operation *op) ...@@ -685,6 +690,7 @@ void afs_fs_remove_file(struct afs_operation *op)
bp = (void *) bp + padsz; bp = (void *) bp + padsz;
} }
call->fid = dvp->fid;
trace_afs_make_fs_call1(call, &dvp->fid, name); trace_afs_make_fs_call1(call, &dvp->fid, name);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -732,6 +738,7 @@ void afs_fs_remove_dir(struct afs_operation *op) ...@@ -732,6 +738,7 @@ void afs_fs_remove_dir(struct afs_operation *op)
bp = (void *) bp + padsz; bp = (void *) bp + padsz;
} }
call->fid = dvp->fid;
trace_afs_make_fs_call1(call, &dvp->fid, name); trace_afs_make_fs_call1(call, &dvp->fid, name);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -812,6 +819,7 @@ void afs_fs_link(struct afs_operation *op) ...@@ -812,6 +819,7 @@ void afs_fs_link(struct afs_operation *op)
*bp++ = htonl(vp->fid.vnode); *bp++ = htonl(vp->fid.vnode);
*bp++ = htonl(vp->fid.unique); *bp++ = htonl(vp->fid.unique);
call->fid = vp->fid;
trace_afs_make_fs_call1(call, &vp->fid, name); trace_afs_make_fs_call1(call, &vp->fid, name);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -907,6 +915,7 @@ void afs_fs_symlink(struct afs_operation *op) ...@@ -907,6 +915,7 @@ void afs_fs_symlink(struct afs_operation *op)
*bp++ = htonl(S_IRWXUGO); /* unix mode */ *bp++ = htonl(S_IRWXUGO); /* unix mode */
*bp++ = 0; /* segment size */ *bp++ = 0; /* segment size */
call->fid = dvp->fid;
trace_afs_make_fs_call1(call, &dvp->fid, name); trace_afs_make_fs_call1(call, &dvp->fid, name);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -1003,6 +1012,7 @@ void afs_fs_rename(struct afs_operation *op) ...@@ -1003,6 +1012,7 @@ void afs_fs_rename(struct afs_operation *op)
bp = (void *) bp + n_padsz; bp = (void *) bp + n_padsz;
} }
call->fid = orig_dvp->fid;
trace_afs_make_fs_call2(call, &orig_dvp->fid, orig_name, new_name); trace_afs_make_fs_call2(call, &orig_dvp->fid, orig_name, new_name);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -1090,6 +1100,7 @@ static void afs_fs_store_data64(struct afs_operation *op) ...@@ -1090,6 +1100,7 @@ static void afs_fs_store_data64(struct afs_operation *op)
*bp++ = htonl(upper_32_bits(op->store.i_size)); *bp++ = htonl(upper_32_bits(op->store.i_size));
*bp++ = htonl(lower_32_bits(op->store.i_size)); *bp++ = htonl(lower_32_bits(op->store.i_size));
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -1140,6 +1151,7 @@ void afs_fs_store_data(struct afs_operation *op) ...@@ -1140,6 +1151,7 @@ void afs_fs_store_data(struct afs_operation *op)
*bp++ = htonl(lower_32_bits(op->store.size)); *bp++ = htonl(lower_32_bits(op->store.size));
*bp++ = htonl(lower_32_bits(op->store.i_size)); *bp++ = htonl(lower_32_bits(op->store.i_size));
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -1206,6 +1218,7 @@ static void afs_fs_setattr_size64(struct afs_operation *op) ...@@ -1206,6 +1218,7 @@ static void afs_fs_setattr_size64(struct afs_operation *op)
*bp++ = htonl(upper_32_bits(attr->ia_size)); /* new file length */ *bp++ = htonl(upper_32_bits(attr->ia_size)); /* new file length */
*bp++ = htonl(lower_32_bits(attr->ia_size)); *bp++ = htonl(lower_32_bits(attr->ia_size));
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -1247,6 +1260,7 @@ static void afs_fs_setattr_size(struct afs_operation *op) ...@@ -1247,6 +1260,7 @@ static void afs_fs_setattr_size(struct afs_operation *op)
*bp++ = 0; /* size of write */ *bp++ = 0; /* size of write */
*bp++ = htonl(attr->ia_size); /* new file length */ *bp++ = htonl(attr->ia_size); /* new file length */
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -1283,6 +1297,7 @@ void afs_fs_setattr(struct afs_operation *op) ...@@ -1283,6 +1297,7 @@ void afs_fs_setattr(struct afs_operation *op)
xdr_encode_AFS_StoreStatus(&bp, op->setattr.attr); xdr_encode_AFS_StoreStatus(&bp, op->setattr.attr);
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -1446,6 +1461,7 @@ void afs_fs_get_volume_status(struct afs_operation *op) ...@@ -1446,6 +1461,7 @@ void afs_fs_get_volume_status(struct afs_operation *op)
bp[0] = htonl(FSGETVOLUMESTATUS); bp[0] = htonl(FSGETVOLUMESTATUS);
bp[1] = htonl(vp->fid.vid); bp[1] = htonl(vp->fid.vid);
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -1528,6 +1544,7 @@ void afs_fs_set_lock(struct afs_operation *op) ...@@ -1528,6 +1544,7 @@ void afs_fs_set_lock(struct afs_operation *op)
*bp++ = htonl(vp->fid.unique); *bp++ = htonl(vp->fid.unique);
*bp++ = htonl(op->lock.type); *bp++ = htonl(op->lock.type);
call->fid = vp->fid;
trace_afs_make_fs_calli(call, &vp->fid, op->lock.type); trace_afs_make_fs_calli(call, &vp->fid, op->lock.type);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -1554,6 +1571,7 @@ void afs_fs_extend_lock(struct afs_operation *op) ...@@ -1554,6 +1571,7 @@ void afs_fs_extend_lock(struct afs_operation *op)
*bp++ = htonl(vp->fid.vnode); *bp++ = htonl(vp->fid.vnode);
*bp++ = htonl(vp->fid.unique); *bp++ = htonl(vp->fid.unique);
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -1580,6 +1598,7 @@ void afs_fs_release_lock(struct afs_operation *op) ...@@ -1580,6 +1598,7 @@ void afs_fs_release_lock(struct afs_operation *op)
*bp++ = htonl(vp->fid.vnode); *bp++ = htonl(vp->fid.vnode);
*bp++ = htonl(vp->fid.unique); *bp++ = htonl(vp->fid.unique);
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -1605,13 +1624,12 @@ static const struct afs_call_type afs_RXFSGiveUpAllCallBacks = { ...@@ -1605,13 +1624,12 @@ static const struct afs_call_type afs_RXFSGiveUpAllCallBacks = {
/* /*
* Flush all the callbacks we have on a server. * Flush all the callbacks we have on a server.
*/ */
int afs_fs_give_up_all_callbacks(struct afs_net *net, int afs_fs_give_up_all_callbacks(struct afs_net *net, struct afs_server *server,
struct afs_server *server, struct afs_address *addr, struct key *key)
struct afs_addr_cursor *ac,
struct key *key)
{ {
struct afs_call *call; struct afs_call *call;
__be32 *bp; __be32 *bp;
int ret;
_enter(""); _enter("");
...@@ -1619,15 +1637,22 @@ int afs_fs_give_up_all_callbacks(struct afs_net *net, ...@@ -1619,15 +1637,22 @@ int afs_fs_give_up_all_callbacks(struct afs_net *net,
if (!call) if (!call)
return -ENOMEM; return -ENOMEM;
call->key = key; call->key = key;
call->peer = rxrpc_kernel_get_peer(addr->peer);
call->service_id = server->service_id;
/* marshall the parameters */ /* marshall the parameters */
bp = call->request; bp = call->request;
*bp++ = htonl(FSGIVEUPALLCALLBACKS); *bp++ = htonl(FSGIVEUPALLCALLBACKS);
call->server = afs_use_server(server, afs_server_trace_give_up_cb); call->server = afs_use_server(server, afs_server_trace_give_up_cb);
afs_make_call(ac, call, GFP_NOFS); afs_make_call(call, GFP_NOFS);
return afs_wait_for_call_to_complete(call, ac); afs_wait_for_call_to_complete(call);
ret = call->error;
if (call->responded)
set_bit(AFS_SERVER_FL_RESPONDING, &server->flags);
afs_put_call(call);
return ret;
} }
/* /*
...@@ -1689,6 +1714,12 @@ static int afs_deliver_fs_get_capabilities(struct afs_call *call) ...@@ -1689,6 +1714,12 @@ static int afs_deliver_fs_get_capabilities(struct afs_call *call)
return 0; return 0;
} }
static void afs_fs_get_capabilities_destructor(struct afs_call *call)
{
afs_put_endpoint_state(call->probe, afs_estate_trace_put_getcaps);
afs_flat_call_destructor(call);
}
/* /*
* FS.GetCapabilities operation type * FS.GetCapabilities operation type
*/ */
...@@ -1697,7 +1728,7 @@ static const struct afs_call_type afs_RXFSGetCapabilities = { ...@@ -1697,7 +1728,7 @@ static const struct afs_call_type afs_RXFSGetCapabilities = {
.op = afs_FS_GetCapabilities, .op = afs_FS_GetCapabilities,
.deliver = afs_deliver_fs_get_capabilities, .deliver = afs_deliver_fs_get_capabilities,
.done = afs_fileserver_probe_result, .done = afs_fileserver_probe_result,
.destructor = afs_flat_call_destructor, .destructor = afs_fs_get_capabilities_destructor,
}; };
/* /*
...@@ -1707,7 +1738,8 @@ static const struct afs_call_type afs_RXFSGetCapabilities = { ...@@ -1707,7 +1738,8 @@ static const struct afs_call_type afs_RXFSGetCapabilities = {
* ->done() - otherwise we return false to indicate we didn't even try. * ->done() - otherwise we return false to indicate we didn't even try.
*/ */
bool afs_fs_get_capabilities(struct afs_net *net, struct afs_server *server, bool afs_fs_get_capabilities(struct afs_net *net, struct afs_server *server,
struct afs_addr_cursor *ac, struct key *key) struct afs_endpoint_state *estate, unsigned int addr_index,
struct key *key)
{ {
struct afs_call *call; struct afs_call *call;
__be32 *bp; __be32 *bp;
...@@ -1718,10 +1750,14 @@ bool afs_fs_get_capabilities(struct afs_net *net, struct afs_server *server, ...@@ -1718,10 +1750,14 @@ bool afs_fs_get_capabilities(struct afs_net *net, struct afs_server *server,
if (!call) if (!call)
return false; return false;
call->key = key; call->key = key;
call->server = afs_use_server(server, afs_server_trace_get_caps); call->server = afs_use_server(server, afs_server_trace_get_caps);
call->upgrade = true; call->peer = rxrpc_kernel_get_peer(estate->addresses->addrs[addr_index].peer);
call->async = true; call->probe = afs_get_endpoint_state(estate, afs_estate_trace_get_getcaps);
call->probe_index = addr_index;
call->service_id = server->service_id;
call->upgrade = true;
call->async = true;
call->max_lifespan = AFS_PROBE_MAX_LIFESPAN; call->max_lifespan = AFS_PROBE_MAX_LIFESPAN;
/* marshall the parameters */ /* marshall the parameters */
...@@ -1729,7 +1765,7 @@ bool afs_fs_get_capabilities(struct afs_net *net, struct afs_server *server, ...@@ -1729,7 +1765,7 @@ bool afs_fs_get_capabilities(struct afs_net *net, struct afs_server *server,
*bp++ = htonl(FSGETCAPABILITIES); *bp++ = htonl(FSGETCAPABILITIES);
trace_afs_make_fs_call(call, NULL); trace_afs_make_fs_call(call, NULL);
afs_make_call(ac, call, GFP_NOFS); afs_make_call(call, GFP_NOFS);
afs_put_call(call); afs_put_call(call);
return true; return true;
} }
...@@ -1853,7 +1889,10 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) ...@@ -1853,7 +1889,10 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
return ret; return ret;
bp = call->buffer; bp = call->buffer;
xdr_decode_AFSVolSync(&bp, &op->volsync); /* Unfortunately, prior to OpenAFS-1.6, volsync here is filled
* with rubbish.
*/
xdr_decode_AFSVolSync(&bp, NULL);
call->unmarshall++; call->unmarshall++;
fallthrough; fallthrough;
...@@ -1899,7 +1938,7 @@ void afs_fs_inline_bulk_status(struct afs_operation *op) ...@@ -1899,7 +1938,7 @@ void afs_fs_inline_bulk_status(struct afs_operation *op)
int i; int i;
if (test_bit(AFS_SERVER_FL_NO_IBULK, &op->server->flags)) { if (test_bit(AFS_SERVER_FL_NO_IBULK, &op->server->flags)) {
op->error = -ENOTSUPP; afs_op_set_error(op, -ENOTSUPP);
return; return;
} }
...@@ -1928,6 +1967,7 @@ void afs_fs_inline_bulk_status(struct afs_operation *op) ...@@ -1928,6 +1967,7 @@ void afs_fs_inline_bulk_status(struct afs_operation *op)
*bp++ = htonl(op->more_files[i].fid.unique); *bp++ = htonl(op->more_files[i].fid.unique);
} }
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
...@@ -2033,6 +2073,7 @@ void afs_fs_fetch_acl(struct afs_operation *op) ...@@ -2033,6 +2073,7 @@ void afs_fs_fetch_acl(struct afs_operation *op)
bp[2] = htonl(vp->fid.vnode); bp[2] = htonl(vp->fid.vnode);
bp[3] = htonl(vp->fid.unique); bp[3] = htonl(vp->fid.unique);
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_KERNEL); afs_make_op_call(op, call, GFP_KERNEL);
} }
...@@ -2078,6 +2119,7 @@ void afs_fs_store_acl(struct afs_operation *op) ...@@ -2078,6 +2119,7 @@ void afs_fs_store_acl(struct afs_operation *op)
if (acl->size != size) if (acl->size != size)
memset((void *)&bp[5] + acl->size, 0, size - acl->size); memset((void *)&bp[5] + acl->size, 0, size - acl->size);
call->fid = vp->fid;
trace_afs_make_fs_call(call, &vp->fid); trace_afs_make_fs_call(call, &vp->fid);
afs_make_op_call(op, call, GFP_KERNEL); afs_make_op_call(op, call, GFP_KERNEL);
} }
...@@ -85,8 +85,7 @@ static int afs_inode_init_from_status(struct afs_operation *op, ...@@ -85,8 +85,7 @@ static int afs_inode_init_from_status(struct afs_operation *op,
write_seqlock(&vnode->cb_lock); write_seqlock(&vnode->cb_lock);
vnode->cb_v_break = op->cb_v_break; vnode->cb_v_check = op->cb_v_break;
vnode->cb_s_break = op->cb_s_break;
vnode->status = *status; vnode->status = *status;
t = status->mtime_client; t = status->mtime_client;
...@@ -146,11 +145,10 @@ static int afs_inode_init_from_status(struct afs_operation *op, ...@@ -146,11 +145,10 @@ static int afs_inode_init_from_status(struct afs_operation *op,
if (!vp->scb.have_cb) { if (!vp->scb.have_cb) {
/* it's a symlink we just created (the fileserver /* it's a symlink we just created (the fileserver
* didn't give us a callback) */ * didn't give us a callback) */
vnode->cb_expires_at = ktime_get_real_seconds(); atomic64_set(&vnode->cb_expires_at, AFS_NO_CB_PROMISE);
} else { } else {
vnode->cb_expires_at = vp->scb.callback.expires_at;
vnode->cb_server = op->server; vnode->cb_server = op->server;
set_bit(AFS_VNODE_CB_PROMISED, &vnode->flags); atomic64_set(&vnode->cb_expires_at, vp->scb.callback.expires_at);
} }
write_sequnlock(&vnode->cb_lock); write_sequnlock(&vnode->cb_lock);
...@@ -214,7 +212,8 @@ static void afs_apply_status(struct afs_operation *op, ...@@ -214,7 +212,8 @@ static void afs_apply_status(struct afs_operation *op,
vnode->status = *status; vnode->status = *status;
if (vp->dv_before + vp->dv_delta != status->data_version) { if (vp->dv_before + vp->dv_delta != status->data_version) {
if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) if (vnode->cb_ro_snapshot == atomic_read(&vnode->volume->cb_ro_snapshot) &&
atomic64_read(&vnode->cb_expires_at) != AFS_NO_CB_PROMISE)
pr_warn("kAFS: vnode modified {%llx:%llu} %llx->%llx %s (op=%x)\n", pr_warn("kAFS: vnode modified {%llx:%llu} %llx->%llx %s (op=%x)\n",
vnode->fid.vid, vnode->fid.vnode, vnode->fid.vid, vnode->fid.vnode,
(unsigned long long)vp->dv_before + vp->dv_delta, (unsigned long long)vp->dv_before + vp->dv_delta,
...@@ -268,9 +267,9 @@ static void afs_apply_callback(struct afs_operation *op, ...@@ -268,9 +267,9 @@ static void afs_apply_callback(struct afs_operation *op,
struct afs_vnode *vnode = vp->vnode; struct afs_vnode *vnode = vp->vnode;
if (!afs_cb_is_broken(vp->cb_break_before, vnode)) { if (!afs_cb_is_broken(vp->cb_break_before, vnode)) {
vnode->cb_expires_at = cb->expires_at; if (op->volume->type == AFSVL_RWVOL)
vnode->cb_server = op->server; vnode->cb_server = op->server;
set_bit(AFS_VNODE_CB_PROMISED, &vnode->flags); atomic64_set(&vnode->cb_expires_at, cb->expires_at);
} }
} }
...@@ -331,7 +330,7 @@ static void afs_fetch_status_success(struct afs_operation *op) ...@@ -331,7 +330,7 @@ static void afs_fetch_status_success(struct afs_operation *op)
if (vnode->netfs.inode.i_state & I_NEW) { if (vnode->netfs.inode.i_state & I_NEW) {
ret = afs_inode_init_from_status(op, vp, vnode); ret = afs_inode_init_from_status(op, vp, vnode);
op->error = ret; afs_op_set_error(op, ret);
if (ret == 0) if (ret == 0)
afs_cache_permit(vnode, op->key, vp->cb_break_before, &vp->scb); afs_cache_permit(vnode, op->key, vp->cb_break_before, &vp->scb);
} else { } else {
...@@ -542,7 +541,7 @@ struct inode *afs_root_iget(struct super_block *sb, struct key *key) ...@@ -542,7 +541,7 @@ struct inode *afs_root_iget(struct super_block *sb, struct key *key)
BUG_ON(!(inode->i_state & I_NEW)); BUG_ON(!(inode->i_state & I_NEW));
vnode = AFS_FS_I(inode); vnode = AFS_FS_I(inode);
vnode->cb_v_break = as->volume->cb_v_break, vnode->cb_v_check = atomic_read(&as->volume->cb_v_break),
afs_set_netfs_context(vnode); afs_set_netfs_context(vnode);
op = afs_alloc_operation(key, as->volume); op = afs_alloc_operation(key, as->volume);
...@@ -572,180 +571,6 @@ struct inode *afs_root_iget(struct super_block *sb, struct key *key) ...@@ -572,180 +571,6 @@ struct inode *afs_root_iget(struct super_block *sb, struct key *key)
return ERR_PTR(ret); return ERR_PTR(ret);
} }
/*
* mark the data attached to an inode as obsolete due to a write on the server
* - might also want to ditch all the outstanding writes and dirty pages
*/
static void afs_zap_data(struct afs_vnode *vnode)
{
_enter("{%llx:%llu}", vnode->fid.vid, vnode->fid.vnode);
afs_invalidate_cache(vnode, 0);
/* nuke all the non-dirty pages that aren't locked, mapped or being
* written back in a regular file and completely discard the pages in a
* directory or symlink */
if (S_ISREG(vnode->netfs.inode.i_mode))
invalidate_remote_inode(&vnode->netfs.inode);
else
invalidate_inode_pages2(vnode->netfs.inode.i_mapping);
}
/*
* Check to see if we have a server currently serving this volume and that it
* hasn't been reinitialised or dropped from the list.
*/
static bool afs_check_server_good(struct afs_vnode *vnode)
{
struct afs_server_list *slist;
struct afs_server *server;
bool good;
int i;
if (vnode->cb_fs_s_break == atomic_read(&vnode->volume->cell->fs_s_break))
return true;
rcu_read_lock();
slist = rcu_dereference(vnode->volume->servers);
for (i = 0; i < slist->nr_servers; i++) {
server = slist->servers[i].server;
if (server == vnode->cb_server) {
good = (vnode->cb_s_break == server->cb_s_break);
rcu_read_unlock();
return good;
}
}
rcu_read_unlock();
return false;
}
/*
* Check the validity of a vnode/inode.
*/
bool afs_check_validity(struct afs_vnode *vnode)
{
enum afs_cb_break_reason need_clear = afs_cb_break_no_break;
time64_t now = ktime_get_real_seconds();
unsigned int cb_break;
int seq = 0;
do {
read_seqbegin_or_lock(&vnode->cb_lock, &seq);
cb_break = vnode->cb_break;
if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
if (vnode->cb_v_break != vnode->volume->cb_v_break)
need_clear = afs_cb_break_for_v_break;
else if (!afs_check_server_good(vnode))
need_clear = afs_cb_break_for_s_reinit;
else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags))
need_clear = afs_cb_break_for_zap;
else if (vnode->cb_expires_at - 10 <= now)
need_clear = afs_cb_break_for_lapsed;
} else if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) {
;
} else {
need_clear = afs_cb_break_no_promise;
}
} while (need_seqretry(&vnode->cb_lock, seq));
done_seqretry(&vnode->cb_lock, seq);
if (need_clear == afs_cb_break_no_break)
return true;
write_seqlock(&vnode->cb_lock);
if (need_clear == afs_cb_break_no_promise)
vnode->cb_v_break = vnode->volume->cb_v_break;
else if (cb_break == vnode->cb_break)
__afs_break_callback(vnode, need_clear);
else
trace_afs_cb_miss(&vnode->fid, need_clear);
write_sequnlock(&vnode->cb_lock);
return false;
}
/*
* Returns true if the pagecache is still valid. Does not sleep.
*/
bool afs_pagecache_valid(struct afs_vnode *vnode)
{
if (unlikely(test_bit(AFS_VNODE_DELETED, &vnode->flags))) {
if (vnode->netfs.inode.i_nlink)
clear_nlink(&vnode->netfs.inode);
return true;
}
if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags) &&
afs_check_validity(vnode))
return true;
return false;
}
/*
* validate a vnode/inode
* - there are several things we need to check
* - parent dir data changes (rm, rmdir, rename, mkdir, create, link,
* symlink)
* - parent dir metadata changed (security changes)
* - dentry data changed (write, truncate)
* - dentry metadata changed (security changes)
*/
int afs_validate(struct afs_vnode *vnode, struct key *key)
{
int ret;
_enter("{v={%llx:%llu} fl=%lx},%x",
vnode->fid.vid, vnode->fid.vnode, vnode->flags,
key_serial(key));
if (afs_pagecache_valid(vnode))
goto valid;
down_write(&vnode->validate_lock);
/* if the promise has expired, we need to check the server again to get
* a new promise - note that if the (parent) directory's metadata was
* changed then the security may be different and we may no longer have
* access */
if (!test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
_debug("not promised");
ret = afs_fetch_status(vnode, key, false, NULL);
if (ret < 0) {
if (ret == -ENOENT) {
set_bit(AFS_VNODE_DELETED, &vnode->flags);
ret = -ESTALE;
}
goto error_unlock;
}
_debug("new promise [fl=%lx]", vnode->flags);
}
if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) {
_debug("file already deleted");
ret = -ESTALE;
goto error_unlock;
}
/* if the vnode's data version number changed then its contents are
* different */
if (test_and_clear_bit(AFS_VNODE_ZAP_DATA, &vnode->flags))
afs_zap_data(vnode);
up_write(&vnode->validate_lock);
valid:
_leave(" = 0");
return 0;
error_unlock:
up_write(&vnode->validate_lock);
_leave(" = %d", ret);
return ret;
}
/* /*
* read the attributes of an inode * read the attributes of an inode
*/ */
...@@ -755,13 +580,13 @@ int afs_getattr(struct mnt_idmap *idmap, const struct path *path, ...@@ -755,13 +580,13 @@ int afs_getattr(struct mnt_idmap *idmap, const struct path *path,
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);
struct afs_vnode *vnode = AFS_FS_I(inode); struct afs_vnode *vnode = AFS_FS_I(inode);
struct key *key; struct key *key;
int ret, seq = 0; int ret, seq;
_enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation); _enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation);
if (vnode->volume && if (vnode->volume &&
!(query_flags & AT_STATX_DONT_SYNC) && !(query_flags & AT_STATX_DONT_SYNC) &&
!test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) { atomic64_read(&vnode->cb_expires_at) == AFS_NO_CB_PROMISE) {
key = afs_request_key(vnode->volume->cell); key = afs_request_key(vnode->volume->cell);
if (IS_ERR(key)) if (IS_ERR(key))
return PTR_ERR(key); return PTR_ERR(key);
...@@ -772,7 +597,7 @@ int afs_getattr(struct mnt_idmap *idmap, const struct path *path, ...@@ -772,7 +597,7 @@ int afs_getattr(struct mnt_idmap *idmap, const struct path *path,
} }
do { do {
read_seqbegin_or_lock(&vnode->cb_lock, &seq); seq = read_seqbegin(&vnode->cb_lock);
generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat); generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
if (test_bit(AFS_VNODE_SILLY_DELETED, &vnode->flags) && if (test_bit(AFS_VNODE_SILLY_DELETED, &vnode->flags) &&
stat->nlink > 0) stat->nlink > 0)
...@@ -784,9 +609,8 @@ int afs_getattr(struct mnt_idmap *idmap, const struct path *path, ...@@ -784,9 +609,8 @@ int afs_getattr(struct mnt_idmap *idmap, const struct path *path,
*/ */
if (S_ISDIR(inode->i_mode)) if (S_ISDIR(inode->i_mode))
stat->size = vnode->netfs.remote_i_size; stat->size = vnode->netfs.remote_i_size;
} while (need_seqretry(&vnode->cb_lock, seq)); } while (read_seqretry(&vnode->cb_lock, seq));
done_seqretry(&vnode->cb_lock, seq);
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -156,6 +156,7 @@ static void __net_exit afs_net_exit(struct net *net_ns) ...@@ -156,6 +156,7 @@ static void __net_exit afs_net_exit(struct net *net_ns)
afs_close_socket(net); afs_close_socket(net);
afs_proc_cleanup(net); afs_proc_cleanup(net);
afs_put_sysnames(net->sysnames); afs_put_sysnames(net->sysnames);
kfree_rcu(rcu_access_pointer(net->address_prefs), rcu);
} }
static struct pernet_operations afs_net_ops = { static struct pernet_operations afs_net_ops = {
......
...@@ -116,6 +116,8 @@ void afs_prioritise_error(struct afs_error *e, int error, u32 abort_code) ...@@ -116,6 +116,8 @@ void afs_prioritise_error(struct afs_error *e, int error, u32 abort_code)
{ {
switch (error) { switch (error) {
case 0: case 0:
e->aborted = false;
e->error = 0;
return; return;
default: default:
if (e->error == -ETIMEDOUT || if (e->error == -ETIMEDOUT ||
...@@ -161,12 +163,16 @@ void afs_prioritise_error(struct afs_error *e, int error, u32 abort_code) ...@@ -161,12 +163,16 @@ void afs_prioritise_error(struct afs_error *e, int error, u32 abort_code)
if (e->responded) if (e->responded)
return; return;
e->error = error; e->error = error;
e->aborted = false;
return; return;
case -ECONNABORTED: case -ECONNABORTED:
error = afs_abort_to_error(abort_code); e->error = afs_abort_to_error(abort_code);
fallthrough; e->aborted = true;
e->responded = true;
return;
case -ENETRESET: /* Responded, but we seem to have changed address */ case -ENETRESET: /* Responded, but we seem to have changed address */
e->aborted = false;
e->responded = true; e->responded = true;
e->error = error; e->error = error;
return; return;
......
...@@ -146,6 +146,55 @@ static int afs_proc_cells_write(struct file *file, char *buf, size_t size) ...@@ -146,6 +146,55 @@ static int afs_proc_cells_write(struct file *file, char *buf, size_t size)
goto done; goto done;
} }
/*
* Display the list of addr_prefs known to the namespace.
*/
static int afs_proc_addr_prefs_show(struct seq_file *m, void *v)
{
struct afs_addr_preference_list *preflist;
struct afs_addr_preference *pref;
struct afs_net *net = afs_seq2net_single(m);
union {
struct sockaddr_in sin;
struct sockaddr_in6 sin6;
} addr;
unsigned int i;
char buf[44]; /* Maximum ipv6 + max subnet is 43 */
rcu_read_lock();
preflist = rcu_dereference(net->address_prefs);
if (!preflist) {
seq_puts(m, "NO PREFS\n");
return 0;
}
seq_printf(m, "PROT SUBNET PRIOR (v=%u n=%u/%u/%u)\n",
preflist->version, preflist->ipv6_off, preflist->nr, preflist->max_prefs);
memset(&addr, 0, sizeof(addr));
for (i = 0; i < preflist->nr; i++) {
pref = &preflist->prefs[i];
addr.sin.sin_family = pref->family;
if (pref->family == AF_INET) {
memcpy(&addr.sin.sin_addr, &pref->ipv4_addr,
sizeof(addr.sin.sin_addr));
snprintf(buf, sizeof(buf), "%pISc/%u", &addr.sin, pref->subnet_mask);
seq_printf(m, "UDP %-43.43s %5u\n", buf, pref->prio);
} else {
memcpy(&addr.sin6.sin6_addr, &pref->ipv6_addr,
sizeof(addr.sin6.sin6_addr));
snprintf(buf, sizeof(buf), "%pISc/%u", &addr.sin6, pref->subnet_mask);
seq_printf(m, "UDP %-43.43s %5u\n", buf, pref->prio);
}
}
rcu_read_lock();
return 0;
}
/* /*
* Display the name of the current workstation cell. * Display the name of the current workstation cell.
*/ */
...@@ -307,7 +356,7 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v) ...@@ -307,7 +356,7 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v)
for (i = 0; i < alist->nr_addrs; i++) for (i = 0; i < alist->nr_addrs; i++)
seq_printf(m, " %c %pISpc\n", seq_printf(m, " %c %pISpc\n",
alist->preferred == i ? '>' : '-', alist->preferred == i ? '>' : '-',
&alist->addrs[i].transport); rxrpc_kernel_remote_addr(alist->addrs[i].peer));
} }
seq_printf(m, " info: fl=%lx rtt=%d\n", vlserver->flags, vlserver->rtt); seq_printf(m, " info: fl=%lx rtt=%d\n", vlserver->flags, vlserver->rtt);
seq_printf(m, " probe: fl=%x e=%d ac=%d out=%d\n", seq_printf(m, " probe: fl=%x e=%d ac=%d out=%d\n",
...@@ -375,32 +424,45 @@ static const struct seq_operations afs_proc_cell_vlservers_ops = { ...@@ -375,32 +424,45 @@ static const struct seq_operations afs_proc_cell_vlservers_ops = {
*/ */
static int afs_proc_servers_show(struct seq_file *m, void *v) static int afs_proc_servers_show(struct seq_file *m, void *v)
{ {
struct afs_server *server; struct afs_endpoint_state *estate;
struct afs_addr_list *alist; struct afs_addr_list *alist;
struct afs_server *server;
unsigned long failed;
int i; int i;
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
seq_puts(m, "UUID REF ACT\n"); seq_puts(m, "UUID REF ACT CELL\n");
return 0; return 0;
} }
server = list_entry(v, struct afs_server, proc_link); server = list_entry(v, struct afs_server, proc_link);
alist = rcu_dereference(server->addresses); estate = rcu_dereference(server->endpoint_state);
seq_printf(m, "%pU %3d %3d\n", alist = estate->addresses;
seq_printf(m, "%pU %3d %3d %s\n",
&server->uuid, &server->uuid,
refcount_read(&server->ref), refcount_read(&server->ref),
atomic_read(&server->active)); atomic_read(&server->active),
seq_printf(m, " - info: fl=%lx rtt=%u brk=%x\n", server->cell->name);
server->flags, server->rtt, server->cb_s_break); seq_printf(m, " - info: fl=%lx rtt=%u\n",
seq_printf(m, " - probe: last=%d out=%d\n", server->flags, server->rtt);
(int)(jiffies - server->probed_at) / HZ, seq_printf(m, " - probe: last=%d\n",
atomic_read(&server->probe_outstanding)); (int)(jiffies - server->probed_at) / HZ);
seq_printf(m, " - ALIST v=%u rsp=%lx f=%lx\n", failed = estate->failed_set;
alist->version, alist->responded, alist->failed); seq_printf(m, " - ESTATE pq=%x np=%u rsp=%lx f=%lx\n",
for (i = 0; i < alist->nr_addrs; i++) estate->probe_seq, atomic_read(&estate->nr_probing),
seq_printf(m, " [%x] %pISpc%s\n", estate->responsive_set, estate->failed_set);
i, &alist->addrs[i].transport, seq_printf(m, " - ALIST v=%u ap=%u\n",
alist->preferred == i ? "*" : ""); alist->version, alist->addr_pref_version);
for (i = 0; i < alist->nr_addrs; i++) {
const struct afs_address *addr = &alist->addrs[i];
seq_printf(m, " [%x] %pISpc%s rtt=%d err=%d p=%u\n",
i, rxrpc_kernel_remote_addr(addr->peer),
alist->preferred == i ? "*" :
test_bit(i, &failed) ? "!" : "",
rxrpc_kernel_get_srtt(addr->peer),
addr->last_error, addr->prio);
}
return 0; return 0;
} }
...@@ -681,7 +743,11 @@ int afs_proc_init(struct afs_net *net) ...@@ -681,7 +743,11 @@ int afs_proc_init(struct afs_net *net)
&afs_proc_sysname_ops, &afs_proc_sysname_ops,
afs_proc_sysname_write, afs_proc_sysname_write,
sizeof(struct seq_net_private), sizeof(struct seq_net_private),
NULL)) NULL) ||
!proc_create_net_single_write("addr_prefs", 0644, p,
afs_proc_addr_prefs_show,
afs_proc_addr_prefs_write,
NULL))
goto error_tree; goto error_tree;
net->proc_afs = p; net->proc_afs = p;
......
This diff is collapsed.
...@@ -178,6 +178,8 @@ void afs_put_call(struct afs_call *call) ...@@ -178,6 +178,8 @@ void afs_put_call(struct afs_call *call)
ASSERT(!work_pending(&call->async_work)); ASSERT(!work_pending(&call->async_work));
ASSERT(call->type->name != NULL); ASSERT(call->type->name != NULL);
rxrpc_kernel_put_peer(call->peer);
if (call->rxcall) { if (call->rxcall) {
rxrpc_kernel_shutdown_call(net->socket, call->rxcall); rxrpc_kernel_shutdown_call(net->socket, call->rxcall);
rxrpc_kernel_put_call(net->socket, call->rxcall); rxrpc_kernel_put_call(net->socket, call->rxcall);
...@@ -187,7 +189,6 @@ void afs_put_call(struct afs_call *call) ...@@ -187,7 +189,6 @@ void afs_put_call(struct afs_call *call)
call->type->destructor(call); call->type->destructor(call);
afs_unuse_server_notime(call->net, call->server, afs_server_trace_put_call); afs_unuse_server_notime(call->net, call->server, afs_server_trace_put_call);
afs_put_addrlist(call->alist);
kfree(call->request); kfree(call->request);
trace_afs_call(call->debug_id, afs_call_trace_free, 0, o, trace_afs_call(call->debug_id, afs_call_trace_free, 0, o,
...@@ -294,9 +295,8 @@ static void afs_notify_end_request_tx(struct sock *sock, ...@@ -294,9 +295,8 @@ static void afs_notify_end_request_tx(struct sock *sock,
* Initiate a call and synchronously queue up the parameters for dispatch. Any * Initiate a call and synchronously queue up the parameters for dispatch. Any
* error is stored into the call struct, which the caller must check for. * error is stored into the call struct, which the caller must check for.
*/ */
void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) void afs_make_call(struct afs_call *call, gfp_t gfp)
{ {
struct sockaddr_rxrpc *srx = &ac->alist->addrs[ac->index];
struct rxrpc_call *rxcall; struct rxrpc_call *rxcall;
struct msghdr msg; struct msghdr msg;
struct kvec iov[1]; struct kvec iov[1];
...@@ -304,7 +304,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) ...@@ -304,7 +304,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
s64 tx_total_len; s64 tx_total_len;
int ret; int ret;
_enter(",{%pISp},", &srx->transport); _enter(",{%pISp+%u},", rxrpc_kernel_remote_addr(call->peer), call->service_id);
ASSERT(call->type != NULL); ASSERT(call->type != NULL);
ASSERT(call->type->name != NULL); ASSERT(call->type->name != NULL);
...@@ -313,8 +313,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) ...@@ -313,8 +313,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
call, call->type->name, key_serial(call->key), call, call->type->name, key_serial(call->key),
atomic_read(&call->net->nr_outstanding_calls)); atomic_read(&call->net->nr_outstanding_calls));
call->addr_ix = ac->index; trace_afs_make_call(call);
call->alist = afs_get_addrlist(ac->alist);
/* Work out the length we're going to transmit. This is awkward for /* Work out the length we're going to transmit. This is awkward for
* calls such as FS.StoreData where there's an extra injection of data * calls such as FS.StoreData where there's an extra injection of data
...@@ -333,7 +332,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) ...@@ -333,7 +332,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
} }
/* create a call */ /* create a call */
rxcall = rxrpc_kernel_begin_call(call->net->socket, srx, call->key, rxcall = rxrpc_kernel_begin_call(call->net->socket, call->peer, call->key,
(unsigned long)call, (unsigned long)call,
tx_total_len, tx_total_len,
call->max_lifespan, call->max_lifespan,
...@@ -341,6 +340,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) ...@@ -341,6 +340,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
(call->async ? (call->async ?
afs_wake_up_async_call : afs_wake_up_async_call :
afs_wake_up_call_waiter), afs_wake_up_call_waiter),
call->service_id,
call->upgrade, call->upgrade,
(call->intr ? RXRPC_PREINTERRUPTIBLE : (call->intr ? RXRPC_PREINTERRUPTIBLE :
RXRPC_UNINTERRUPTIBLE), RXRPC_UNINTERRUPTIBLE),
...@@ -390,7 +390,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) ...@@ -390,7 +390,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
/* Note that at this point, we may have received the reply or an abort /* Note that at this point, we may have received the reply or an abort
* - and an asynchronous call may already have completed. * - and an asynchronous call may already have completed.
* *
* afs_wait_for_call_to_complete(call, ac) * afs_wait_for_call_to_complete(call)
* must be called to synchronously clean up. * must be called to synchronously clean up.
*/ */
return; return;
...@@ -406,8 +406,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) ...@@ -406,8 +406,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
rxrpc_kernel_recv_data(call->net->socket, rxcall, rxrpc_kernel_recv_data(call->net->socket, rxcall,
&msg.msg_iter, &len, false, &msg.msg_iter, &len, false,
&call->abort_code, &call->service_id); &call->abort_code, &call->service_id);
ac->abort_code = call->abort_code; call->responded = true;
ac->responded = true;
} }
call->error = ret; call->error = ret;
trace_afs_call_done(call); trace_afs_call_done(call);
...@@ -427,7 +426,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) ...@@ -427,7 +426,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
afs_set_call_complete(call, ret, 0); afs_set_call_complete(call, ret, 0);
} }
ac->error = ret; call->error = ret;
call->state = AFS_CALL_COMPLETE; call->state = AFS_CALL_COMPLETE;
_leave(" = %d", ret); _leave(" = %d", ret);
} }
...@@ -461,7 +460,7 @@ static void afs_log_error(struct afs_call *call, s32 remote_abort) ...@@ -461,7 +460,7 @@ static void afs_log_error(struct afs_call *call, s32 remote_abort)
max = m + 1; max = m + 1;
pr_notice("kAFS: Peer reported %s failure on %s [%pISp]\n", pr_notice("kAFS: Peer reported %s failure on %s [%pISp]\n",
msg, call->type->name, msg, call->type->name,
&call->alist->addrs[call->addr_ix].transport); rxrpc_kernel_remote_addr(call->peer));
} }
} }
...@@ -508,6 +507,7 @@ static void afs_deliver_to_call(struct afs_call *call) ...@@ -508,6 +507,7 @@ static void afs_deliver_to_call(struct afs_call *call)
ret = -EBADMSG; ret = -EBADMSG;
switch (ret) { switch (ret) {
case 0: case 0:
call->responded = true;
afs_queue_call_work(call); afs_queue_call_work(call);
if (state == AFS_CALL_CL_PROC_REPLY) { if (state == AFS_CALL_CL_PROC_REPLY) {
if (call->op) if (call->op)
...@@ -522,9 +522,11 @@ static void afs_deliver_to_call(struct afs_call *call) ...@@ -522,9 +522,11 @@ static void afs_deliver_to_call(struct afs_call *call)
goto out; goto out;
case -ECONNABORTED: case -ECONNABORTED:
ASSERTCMP(state, ==, AFS_CALL_COMPLETE); ASSERTCMP(state, ==, AFS_CALL_COMPLETE);
call->responded = true;
afs_log_error(call, call->abort_code); afs_log_error(call, call->abort_code);
goto done; goto done;
case -ENOTSUPP: case -ENOTSUPP:
call->responded = true;
abort_code = RXGEN_OPCODE; abort_code = RXGEN_OPCODE;
rxrpc_kernel_abort_call(call->net->socket, call->rxcall, rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
abort_code, ret, abort_code, ret,
...@@ -571,50 +573,46 @@ static void afs_deliver_to_call(struct afs_call *call) ...@@ -571,50 +573,46 @@ static void afs_deliver_to_call(struct afs_call *call)
} }
/* /*
* Wait synchronously for a call to complete and clean up the call struct. * Wait synchronously for a call to complete.
*/ */
long afs_wait_for_call_to_complete(struct afs_call *call, void afs_wait_for_call_to_complete(struct afs_call *call)
struct afs_addr_cursor *ac)
{ {
long ret;
bool rxrpc_complete = false; bool rxrpc_complete = false;
DECLARE_WAITQUEUE(myself, current);
_enter(""); _enter("");
ret = call->error; if (!afs_check_call_state(call, AFS_CALL_COMPLETE)) {
if (ret < 0) DECLARE_WAITQUEUE(myself, current);
goto out;
add_wait_queue(&call->waitq, &myself);
for (;;) {
set_current_state(TASK_UNINTERRUPTIBLE);
/* deliver any messages that are in the queue */
if (!afs_check_call_state(call, AFS_CALL_COMPLETE) &&
call->need_attention) {
call->need_attention = false;
__set_current_state(TASK_RUNNING);
afs_deliver_to_call(call);
continue;
}
add_wait_queue(&call->waitq, &myself); if (afs_check_call_state(call, AFS_CALL_COMPLETE))
for (;;) { break;
set_current_state(TASK_UNINTERRUPTIBLE);
/* deliver any messages that are in the queue */
if (!afs_check_call_state(call, AFS_CALL_COMPLETE) &&
call->need_attention) {
call->need_attention = false;
__set_current_state(TASK_RUNNING);
afs_deliver_to_call(call);
continue;
}
if (afs_check_call_state(call, AFS_CALL_COMPLETE)) if (!rxrpc_kernel_check_life(call->net->socket, call->rxcall)) {
break; /* rxrpc terminated the call. */
rxrpc_complete = true;
break;
}
if (!rxrpc_kernel_check_life(call->net->socket, call->rxcall)) { schedule();
/* rxrpc terminated the call. */
rxrpc_complete = true;
break;
} }
schedule(); remove_wait_queue(&call->waitq, &myself);
__set_current_state(TASK_RUNNING);
} }
remove_wait_queue(&call->waitq, &myself);
__set_current_state(TASK_RUNNING);
if (!afs_check_call_state(call, AFS_CALL_COMPLETE)) { if (!afs_check_call_state(call, AFS_CALL_COMPLETE)) {
if (rxrpc_complete) { if (rxrpc_complete) {
afs_set_call_complete(call, call->error, call->abort_code); afs_set_call_complete(call, call->error, call->abort_code);
...@@ -627,29 +625,6 @@ long afs_wait_for_call_to_complete(struct afs_call *call, ...@@ -627,29 +625,6 @@ long afs_wait_for_call_to_complete(struct afs_call *call,
afs_set_call_complete(call, -EINTR, 0); afs_set_call_complete(call, -EINTR, 0);
} }
} }
spin_lock_bh(&call->state_lock);
ac->abort_code = call->abort_code;
ac->error = call->error;
spin_unlock_bh(&call->state_lock);
ret = ac->error;
switch (ret) {
case 0:
ret = call->ret0;
call->ret0 = 0;
fallthrough;
case -ECONNABORTED:
ac->responded = true;
break;
}
out:
_debug("call complete");
afs_put_call(call);
_leave(" = %p", (void *)ret);
return ret;
} }
/* /*
......
This diff is collapsed.
This diff is collapsed.
...@@ -381,8 +381,7 @@ static int afs_validate_fc(struct fs_context *fc) ...@@ -381,8 +381,7 @@ static int afs_validate_fc(struct fs_context *fc)
ctx->key = key; ctx->key = key;
if (ctx->volume) { if (ctx->volume) {
afs_put_volume(ctx->net, ctx->volume, afs_put_volume(ctx->volume, afs_volume_trace_put_validate_fc);
afs_volume_trace_put_validate_fc);
ctx->volume = NULL; ctx->volume = NULL;
} }
...@@ -529,7 +528,7 @@ static void afs_destroy_sbi(struct afs_super_info *as) ...@@ -529,7 +528,7 @@ static void afs_destroy_sbi(struct afs_super_info *as)
{ {
if (as) { if (as) {
struct afs_net *net = afs_net(as->net_ns); struct afs_net *net = afs_net(as->net_ns);
afs_put_volume(net, as->volume, afs_volume_trace_put_destroy_sbi); afs_put_volume(as->volume, afs_volume_trace_put_destroy_sbi);
afs_unuse_cell(net, as->cell, afs_cell_trace_unuse_sbi); afs_unuse_cell(net, as->cell, afs_cell_trace_unuse_sbi);
put_net(as->net_ns); put_net(as->net_ns);
kfree(as); kfree(as);
...@@ -615,7 +614,7 @@ static void afs_free_fc(struct fs_context *fc) ...@@ -615,7 +614,7 @@ static void afs_free_fc(struct fs_context *fc)
struct afs_fs_context *ctx = fc->fs_private; struct afs_fs_context *ctx = fc->fs_private;
afs_destroy_sbi(fc->s_fs_info); afs_destroy_sbi(fc->s_fs_info);
afs_put_volume(ctx->net, ctx->volume, afs_volume_trace_put_free_fc); afs_put_volume(ctx->volume, afs_volume_trace_put_free_fc);
afs_unuse_cell(ctx->net, ctx->cell, afs_cell_trace_unuse_fc); afs_unuse_cell(ctx->net, ctx->cell, afs_cell_trace_unuse_fc);
key_put(ctx->key); key_put(ctx->key);
kfree(ctx); kfree(ctx);
......
This diff is collapsed.
...@@ -32,55 +32,6 @@ static struct afs_volume *afs_sample_volume(struct afs_cell *cell, struct key *k ...@@ -32,55 +32,6 @@ static struct afs_volume *afs_sample_volume(struct afs_cell *cell, struct key *k
return volume; return volume;
} }
/*
* Compare two addresses.
*/
static int afs_compare_addrs(const struct sockaddr_rxrpc *srx_a,
const struct sockaddr_rxrpc *srx_b)
{
short port_a, port_b;
int addr_a, addr_b, diff;
diff = (short)srx_a->transport_type - (short)srx_b->transport_type;
if (diff)
goto out;
switch (srx_a->transport_type) {
case AF_INET: {
const struct sockaddr_in *a = &srx_a->transport.sin;
const struct sockaddr_in *b = &srx_b->transport.sin;
addr_a = ntohl(a->sin_addr.s_addr);
addr_b = ntohl(b->sin_addr.s_addr);
diff = addr_a - addr_b;
if (diff == 0) {
port_a = ntohs(a->sin_port);
port_b = ntohs(b->sin_port);
diff = port_a - port_b;
}
break;
}
case AF_INET6: {
const struct sockaddr_in6 *a = &srx_a->transport.sin6;
const struct sockaddr_in6 *b = &srx_b->transport.sin6;
diff = memcmp(&a->sin6_addr, &b->sin6_addr, 16);
if (diff == 0) {
port_a = ntohs(a->sin6_port);
port_b = ntohs(b->sin6_port);
diff = port_a - port_b;
}
break;
}
default:
WARN_ON(1);
diff = 1;
}
out:
return diff;
}
/* /*
* Compare the address lists of a pair of fileservers. * Compare the address lists of a pair of fileservers.
*/ */
...@@ -90,13 +41,13 @@ static int afs_compare_fs_alists(const struct afs_server *server_a, ...@@ -90,13 +41,13 @@ static int afs_compare_fs_alists(const struct afs_server *server_a,
const struct afs_addr_list *la, *lb; const struct afs_addr_list *la, *lb;
int a = 0, b = 0, addr_matches = 0; int a = 0, b = 0, addr_matches = 0;
la = rcu_dereference(server_a->addresses); la = rcu_dereference(server_a->endpoint_state)->addresses;
lb = rcu_dereference(server_b->addresses); lb = rcu_dereference(server_b->endpoint_state)->addresses;
while (a < la->nr_addrs && b < lb->nr_addrs) { while (a < la->nr_addrs && b < lb->nr_addrs) {
const struct sockaddr_rxrpc *srx_a = &la->addrs[a]; unsigned long pa = (unsigned long)la->addrs[a].peer;
const struct sockaddr_rxrpc *srx_b = &lb->addrs[b]; unsigned long pb = (unsigned long)lb->addrs[b].peer;
int diff = afs_compare_addrs(srx_a, srx_b); long diff = pa - pb;
if (diff < 0) { if (diff < 0) {
a++; a++;
...@@ -126,7 +77,7 @@ static int afs_compare_volume_slists(const struct afs_volume *vol_a, ...@@ -126,7 +77,7 @@ static int afs_compare_volume_slists(const struct afs_volume *vol_a,
lb = rcu_dereference(vol_b->servers); lb = rcu_dereference(vol_b->servers);
for (i = 0; i < AFS_MAXTYPES; i++) for (i = 0; i < AFS_MAXTYPES; i++)
if (la->vids[i] != lb->vids[i]) if (vol_a->vids[i] != vol_b->vids[i])
return 0; return 0;
while (a < la->nr_servers && b < lb->nr_servers) { while (a < la->nr_servers && b < lb->nr_servers) {
...@@ -205,7 +156,7 @@ static int afs_query_for_alias_one(struct afs_cell *cell, struct key *key, ...@@ -205,7 +156,7 @@ static int afs_query_for_alias_one(struct afs_cell *cell, struct key *key,
/* And see if it's in the new cell. */ /* And see if it's in the new cell. */
volume = afs_sample_volume(cell, key, pvol->name, pvol->name_len); volume = afs_sample_volume(cell, key, pvol->name, pvol->name_len);
if (IS_ERR(volume)) { if (IS_ERR(volume)) {
afs_put_volume(cell->net, pvol, afs_volume_trace_put_query_alias); afs_put_volume(pvol, afs_volume_trace_put_query_alias);
if (PTR_ERR(volume) != -ENOMEDIUM) if (PTR_ERR(volume) != -ENOMEDIUM)
return PTR_ERR(volume); return PTR_ERR(volume);
/* That volume is not in the new cell, so not an alias */ /* That volume is not in the new cell, so not an alias */
...@@ -223,8 +174,8 @@ static int afs_query_for_alias_one(struct afs_cell *cell, struct key *key, ...@@ -223,8 +174,8 @@ static int afs_query_for_alias_one(struct afs_cell *cell, struct key *key,
rcu_read_unlock(); rcu_read_unlock();
} }
afs_put_volume(cell->net, volume, afs_volume_trace_put_query_alias); afs_put_volume(volume, afs_volume_trace_put_query_alias);
afs_put_volume(cell->net, pvol, afs_volume_trace_put_query_alias); afs_put_volume(pvol, afs_volume_trace_put_query_alias);
return ret; return ret;
} }
...@@ -285,7 +236,7 @@ static char *afs_vl_get_cell_name(struct afs_cell *cell, struct key *key) ...@@ -285,7 +236,7 @@ static char *afs_vl_get_cell_name(struct afs_cell *cell, struct key *key)
while (afs_select_vlserver(&vc)) { while (afs_select_vlserver(&vc)) {
if (!test_bit(AFS_VLSERVER_FL_IS_YFS, &vc.server->flags)) { if (!test_bit(AFS_VLSERVER_FL_IS_YFS, &vc.server->flags)) {
vc.ac.error = -EOPNOTSUPP; vc.call_error = -EOPNOTSUPP;
skipped = true; skipped = true;
continue; continue;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -366,7 +366,7 @@ static void afs_store_data_success(struct afs_operation *op) ...@@ -366,7 +366,7 @@ static void afs_store_data_success(struct afs_operation *op)
op->ctime = op->file[0].scb.status.mtime_client; op->ctime = op->file[0].scb.status.mtime_client;
afs_vnode_commit_status(op, &op->file[0]); afs_vnode_commit_status(op, &op->file[0]);
if (op->error == 0) { if (!afs_op_error(op)) {
if (!op->store.laundering) if (!op->store.laundering)
afs_pages_written_back(vnode, op->store.pos, op->store.size); afs_pages_written_back(vnode, op->store.pos, op->store.size);
afs_stat_v(vnode, n_stores); afs_stat_v(vnode, n_stores);
...@@ -428,7 +428,7 @@ static int afs_store_data(struct afs_vnode *vnode, struct iov_iter *iter, loff_t ...@@ -428,7 +428,7 @@ static int afs_store_data(struct afs_vnode *vnode, struct iov_iter *iter, loff_t
afs_wait_for_operation(op); afs_wait_for_operation(op);
switch (op->error) { switch (afs_op_error(op)) {
case -EACCES: case -EACCES:
case -EPERM: case -EPERM:
case -ENOKEY: case -ENOKEY:
...@@ -447,7 +447,7 @@ static int afs_store_data(struct afs_vnode *vnode, struct iov_iter *iter, loff_t ...@@ -447,7 +447,7 @@ static int afs_store_data(struct afs_vnode *vnode, struct iov_iter *iter, loff_t
} }
afs_put_wb_key(wbk); afs_put_wb_key(wbk);
_leave(" = %d", op->error); _leave(" = %d", afs_op_error(op));
return afs_put_operation(op); return afs_put_operation(op);
} }
......
This diff is collapsed.
...@@ -15,6 +15,7 @@ struct key; ...@@ -15,6 +15,7 @@ struct key;
struct sock; struct sock;
struct socket; struct socket;
struct rxrpc_call; struct rxrpc_call;
struct rxrpc_peer;
enum rxrpc_abort_reason; enum rxrpc_abort_reason;
enum rxrpc_interruptibility { enum rxrpc_interruptibility {
...@@ -41,13 +42,14 @@ void rxrpc_kernel_new_call_notification(struct socket *, ...@@ -41,13 +42,14 @@ void rxrpc_kernel_new_call_notification(struct socket *,
rxrpc_notify_new_call_t, rxrpc_notify_new_call_t,
rxrpc_discard_new_call_t); rxrpc_discard_new_call_t);
struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock, struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
struct sockaddr_rxrpc *srx, struct rxrpc_peer *peer,
struct key *key, struct key *key,
unsigned long user_call_ID, unsigned long user_call_ID,
s64 tx_total_len, s64 tx_total_len,
u32 hard_timeout, u32 hard_timeout,
gfp_t gfp, gfp_t gfp,
rxrpc_notify_rx_t notify_rx, rxrpc_notify_rx_t notify_rx,
u16 service_id,
bool upgrade, bool upgrade,
enum rxrpc_interruptibility interruptibility, enum rxrpc_interruptibility interruptibility,
unsigned int debug_id); unsigned int debug_id);
...@@ -60,9 +62,14 @@ bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *, ...@@ -60,9 +62,14 @@ bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
u32, int, enum rxrpc_abort_reason); u32, int, enum rxrpc_abort_reason);
void rxrpc_kernel_shutdown_call(struct socket *sock, struct rxrpc_call *call); void rxrpc_kernel_shutdown_call(struct socket *sock, struct rxrpc_call *call);
void rxrpc_kernel_put_call(struct socket *sock, struct rxrpc_call *call); void rxrpc_kernel_put_call(struct socket *sock, struct rxrpc_call *call);
void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *, struct rxrpc_peer *rxrpc_kernel_lookup_peer(struct socket *sock,
struct sockaddr_rxrpc *); struct sockaddr_rxrpc *srx, gfp_t gfp);
bool rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *, u32 *); void rxrpc_kernel_put_peer(struct rxrpc_peer *peer);
struct rxrpc_peer *rxrpc_kernel_get_peer(struct rxrpc_peer *peer);
struct rxrpc_peer *rxrpc_kernel_get_call_peer(struct socket *sock, struct rxrpc_call *call);
const struct sockaddr_rxrpc *rxrpc_kernel_remote_srx(const struct rxrpc_peer *peer);
const struct sockaddr *rxrpc_kernel_remote_addr(const struct rxrpc_peer *peer);
unsigned int rxrpc_kernel_get_srtt(const struct rxrpc_peer *);
int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t, int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
rxrpc_user_attach_call_t, unsigned long, gfp_t, rxrpc_user_attach_call_t, unsigned long, gfp_t,
unsigned int); unsigned int);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment