Skip to content

Commit 424dd3d

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: eliminate cl_ra_cblist and NFSD4_CLIENT_CB_RECALL_ANY
deleg_reaper() will walk the client_lru list and put any suitable entries onto "cblist" using the cl_ra_cblist pointer. It then walks the objects outside the spinlock and queues callbacks for them. None of the operations that deleg_reaper() does outside the nn->client_lock are blocking operations. Just queue their workqueue jobs under the nn->client_lock instead. Also, the NFSD4_CLIENT_CB_RECALL_ANY and NFSD4_CALLBACK_RUNNING flags serve an identical purpose now. Drop the NFSD4_CLIENT_CB_RECALL_ANY flag and just use the one in the callback. Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 1054e8f commit 424dd3d

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

fs/nfsd/nfs4state.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3175,7 +3175,6 @@ nfsd4_cb_recall_any_release(struct nfsd4_callback *cb)
31753175
{
31763176
struct nfs4_client *clp = cb->cb_clp;
31773177

3178-
clear_bit(NFSD4_CLIENT_CB_RECALL_ANY, &clp->cl_flags);
31793178
drop_client(clp);
31803179
}
31813180

@@ -6881,7 +6880,6 @@ deleg_reaper(struct nfsd_net *nn)
68816880
{
68826881
struct list_head *pos, *next;
68836882
struct nfs4_client *clp;
6884-
LIST_HEAD(cblist);
68856883

68866884
spin_lock(&nn->client_lock);
68876885
list_for_each_safe(pos, next, &nn->client_lru) {
@@ -6893,31 +6891,23 @@ deleg_reaper(struct nfsd_net *nn)
68936891
continue;
68946892
if (atomic_read(&clp->cl_delegs_in_recall))
68956893
continue;
6896-
if (test_bit(NFSD4_CLIENT_CB_RECALL_ANY, &clp->cl_flags))
6894+
if (test_and_set_bit(NFSD4_CALLBACK_RUNNING, &clp->cl_ra->ra_cb.cb_flags))
68976895
continue;
68986896
if (ktime_get_boottime_seconds() - clp->cl_ra_time < 5)
68996897
continue;
69006898
if (clp->cl_cb_state != NFSD4_CB_UP)
69016899
continue;
6902-
list_add(&clp->cl_ra_cblist, &cblist);
69036900

69046901
/* release in nfsd4_cb_recall_any_release */
69056902
kref_get(&clp->cl_nfsdfs.cl_ref);
6906-
set_bit(NFSD4_CLIENT_CB_RECALL_ANY, &clp->cl_flags);
69076903
clp->cl_ra_time = ktime_get_boottime_seconds();
6908-
}
6909-
spin_unlock(&nn->client_lock);
6910-
6911-
while (!list_empty(&cblist)) {
6912-
clp = list_first_entry(&cblist, struct nfs4_client,
6913-
cl_ra_cblist);
6914-
list_del_init(&clp->cl_ra_cblist);
69156904
clp->cl_ra->ra_keep = 0;
69166905
clp->cl_ra->ra_bmval[0] = BIT(RCA4_TYPE_MASK_RDATA_DLG) |
69176906
BIT(RCA4_TYPE_MASK_WDATA_DLG);
69186907
trace_nfsd_cb_recall_any(clp->cl_ra);
6919-
nfsd4_try_run_cb(&clp->cl_ra->ra_cb);
6908+
nfsd4_run_cb(&clp->cl_ra->ra_cb);
69206909
}
6910+
spin_unlock(&nn->client_lock);
69216911
}
69226912

69236913
static void

fs/nfsd/state.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,6 @@ struct nfs4_client {
454454
#define NFSD4_CLIENT_UPCALL_LOCK (5) /* upcall serialization */
455455
#define NFSD4_CLIENT_CB_FLAG_MASK (1 << NFSD4_CLIENT_CB_UPDATE | \
456456
1 << NFSD4_CLIENT_CB_KILL)
457-
#define NFSD4_CLIENT_CB_RECALL_ANY (6)
458457
unsigned long cl_flags;
459458

460459
struct workqueue_struct *cl_callback_wq;
@@ -500,7 +499,6 @@ struct nfs4_client {
500499

501500
struct nfsd4_cb_recall_any *cl_ra;
502501
time64_t cl_ra_time;
503-
struct list_head cl_ra_cblist;
504502
};
505503

506504
/* struct nfs4_client_reset

0 commit comments

Comments
 (0)