Skip to content

Commit c742b63

Browse files
committed
Merge tag 'nfsd-5.8' of git://linux-nfs.org/~bfields/linux
Pull nfsd updates from Bruce Fields: "Highlights: - Keep nfsd clients from unnecessarily breaking their own delegations. Note this requires a small kthreadd addition. The result is Tejun Heo's suggestion (see link), and he was OK with this going through my tree. - Patch nfsd/clients/ to display filenames, and to fix byte-order when displaying stateid's. - fix a module loading/unloading bug, from Neil Brown. - A big series from Chuck Lever with RPC/RDMA and tracing improvements, and lay some groundwork for RPC-over-TLS" Link: https://lore.kernel.org/r/1588348912-24781-1-git-send-email-bfields@redhat.com * tag 'nfsd-5.8' of git://linux-nfs.org/~bfields/linux: (49 commits) sunrpc: use kmemdup_nul() in gssp_stringify() nfsd: safer handling of corrupted c_type nfsd4: make drc_slab global, not per-net SUNRPC: Remove unreachable error condition in rpcb_getport_async() nfsd: Fix svc_xprt refcnt leak when setup callback client failed sunrpc: clean up properly in gss_mech_unregister() sunrpc: svcauth_gss_register_pseudoflavor must reject duplicate registrations. sunrpc: check that domain table is empty at module unload. NFSD: Fix improperly-formatted Doxygen comments NFSD: Squash an annoying compiler warning SUNRPC: Clean up request deferral tracepoints NFSD: Add tracepoints for monitoring NFSD callbacks NFSD: Add tracepoints to the NFSD state management code NFSD: Add tracepoints to NFSD's duplicate reply cache SUNRPC: svc_show_status() macro should have enum definitions SUNRPC: Restructure svc_udp_recvfrom() SUNRPC: Refactor svc_recvfrom() SUNRPC: Clean up svc_release_skb() functions SUNRPC: Refactor recvfrom path dealing with incomplete TCP receives SUNRPC: Replace dprintk() call sites in TCP receive path ...
2 parents b29482f + 1eb2f96 commit c742b63

41 files changed

Lines changed: 1524 additions & 651 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/filesystems/locking.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ prototypes::
429429
int (*lm_grant)(struct file_lock *, struct file_lock *, int);
430430
void (*lm_break)(struct file_lock *); /* break_lease callback */
431431
int (*lm_change)(struct file_lock **, int);
432+
bool (*lm_breaker_owns_lease)(struct file_lock *);
432433

433434
locking rules:
434435

@@ -439,6 +440,7 @@ lm_notify: yes yes no
439440
lm_grant: no no no
440441
lm_break: yes no no
441442
lm_change yes no no
443+
lm_breaker_owns_lease: no no no
442444
========== ============= ================= =========
443445

444446
buffer_head

‎fs/locks.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,9 @@ static bool leases_conflict(struct file_lock *lease, struct file_lock *breaker)
15571557
{
15581558
bool rc;
15591559

1560+
if (lease->fl_lmops->lm_breaker_owns_lease
1561+
&& lease->fl_lmops->lm_breaker_owns_lease(lease))
1562+
return false;
15601563
if ((breaker->fl_flags & FL_LAYOUT) != (lease->fl_flags & FL_LAYOUT)) {
15611564
rc = false;
15621565
goto trace;

‎fs/nfsd/cache.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ enum {
7878
/* Checksum this amount of the request */
7979
#define RC_CSUMLEN (256U)
8080

81+
int nfsd_drc_slab_create(void);
82+
void nfsd_drc_slab_free(void);
8183
int nfsd_reply_cache_init(struct nfsd_net *);
8284
void nfsd_reply_cache_shutdown(struct nfsd_net *);
8385
int nfsd_cache_lookup(struct svc_rqst *);

‎fs/nfsd/netns.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ struct nfsd_net {
139139
* Duplicate reply cache
140140
*/
141141
struct nfsd_drc_bucket *drc_hashtbl;
142-
struct kmem_cache *drc_slab;
143142

144143
/* max number of entries allowed in the cache */
145144
unsigned int max_drc_entries;

‎fs/nfsd/nfs4callback.c‎

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "nfsd.h"
3939
#include "state.h"
4040
#include "netns.h"
41+
#include "trace.h"
4142
#include "xdr4cb.h"
4243
#include "xdr4.h"
4344

@@ -904,16 +905,20 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
904905

905906
if (clp->cl_minorversion == 0) {
906907
if (!clp->cl_cred.cr_principal &&
907-
(clp->cl_cred.cr_flavor >= RPC_AUTH_GSS_KRB5))
908+
(clp->cl_cred.cr_flavor >= RPC_AUTH_GSS_KRB5)) {
909+
trace_nfsd_cb_setup_err(clp, -EINVAL);
908910
return -EINVAL;
911+
}
909912
args.client_name = clp->cl_cred.cr_principal;
910913
args.prognumber = conn->cb_prog;
911914
args.protocol = XPRT_TRANSPORT_TCP;
912915
args.authflavor = clp->cl_cred.cr_flavor;
913916
clp->cl_cb_ident = conn->cb_ident;
914917
} else {
915-
if (!conn->cb_xprt)
918+
if (!conn->cb_xprt) {
919+
trace_nfsd_cb_setup_err(clp, -EINVAL);
916920
return -EINVAL;
921+
}
917922
clp->cl_cb_conn.cb_xprt = conn->cb_xprt;
918923
clp->cl_cb_session = ses;
919924
args.bc_xprt = conn->cb_xprt;
@@ -925,50 +930,48 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
925930
/* Create RPC client */
926931
client = rpc_create(&args);
927932
if (IS_ERR(client)) {
928-
dprintk("NFSD: couldn't create callback client: %ld\n",
929-
PTR_ERR(client));
933+
trace_nfsd_cb_setup_err(clp, PTR_ERR(client));
930934
return PTR_ERR(client);
931935
}
932936
cred = get_backchannel_cred(clp, client, ses);
933937
if (!cred) {
938+
trace_nfsd_cb_setup_err(clp, -ENOMEM);
934939
rpc_shutdown_client(client);
935940
return -ENOMEM;
936941
}
937942
clp->cl_cb_client = client;
938943
clp->cl_cb_cred = cred;
944+
trace_nfsd_cb_setup(clp);
939945
return 0;
940946
}
941947

942-
static void warn_no_callback_path(struct nfs4_client *clp, int reason)
943-
{
944-
dprintk("NFSD: warning: no callback path to client %.*s: error %d\n",
945-
(int)clp->cl_name.len, clp->cl_name.data, reason);
946-
}
947-
948948
static void nfsd4_mark_cb_down(struct nfs4_client *clp, int reason)
949949
{
950950
if (test_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags))
951951
return;
952952
clp->cl_cb_state = NFSD4_CB_DOWN;
953-
warn_no_callback_path(clp, reason);
953+
trace_nfsd_cb_state(clp);
954954
}
955955

956956
static void nfsd4_mark_cb_fault(struct nfs4_client *clp, int reason)
957957
{
958958
if (test_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags))
959959
return;
960960
clp->cl_cb_state = NFSD4_CB_FAULT;
961-
warn_no_callback_path(clp, reason);
961+
trace_nfsd_cb_state(clp);
962962
}
963963

964964
static void nfsd4_cb_probe_done(struct rpc_task *task, void *calldata)
965965
{
966966
struct nfs4_client *clp = container_of(calldata, struct nfs4_client, cl_cb_null);
967967

968+
trace_nfsd_cb_done(clp, task->tk_status);
968969
if (task->tk_status)
969970
nfsd4_mark_cb_down(clp, task->tk_status);
970-
else
971+
else {
971972
clp->cl_cb_state = NFSD4_CB_UP;
973+
trace_nfsd_cb_state(clp);
974+
}
972975
}
973976

974977
static void nfsd4_cb_probe_release(void *calldata)
@@ -993,6 +996,7 @@ static const struct rpc_call_ops nfsd4_cb_probe_ops = {
993996
void nfsd4_probe_callback(struct nfs4_client *clp)
994997
{
995998
clp->cl_cb_state = NFSD4_CB_UNKNOWN;
999+
trace_nfsd_cb_state(clp);
9961000
set_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags);
9971001
nfsd4_run_cb(&clp->cl_cb_null);
9981002
}
@@ -1009,6 +1013,7 @@ void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *conn)
10091013
spin_lock(&clp->cl_lock);
10101014
memcpy(&clp->cl_cb_conn, conn, sizeof(struct nfs4_cb_conn));
10111015
spin_unlock(&clp->cl_lock);
1016+
trace_nfsd_cb_state(clp);
10121017
}
10131018

10141019
/*
@@ -1165,8 +1170,7 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata)
11651170
struct nfsd4_callback *cb = calldata;
11661171
struct nfs4_client *clp = cb->cb_clp;
11671172

1168-
dprintk("%s: minorversion=%d\n", __func__,
1169-
clp->cl_minorversion);
1173+
trace_nfsd_cb_done(clp, task->tk_status);
11701174

11711175
if (!nfsd4_cb_sequence_done(task, cb))
11721176
return;
@@ -1271,6 +1275,7 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb)
12711275
* kill the old client:
12721276
*/
12731277
if (clp->cl_cb_client) {
1278+
trace_nfsd_cb_shutdown(clp);
12741279
rpc_shutdown_client(clp->cl_cb_client);
12751280
clp->cl_cb_client = NULL;
12761281
put_cred(clp->cl_cb_cred);
@@ -1301,6 +1306,8 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb)
13011306
err = setup_callback_client(clp, &conn, ses);
13021307
if (err) {
13031308
nfsd4_mark_cb_down(clp, err);
1309+
if (c)
1310+
svc_xprt_put(c->cn_xprt);
13041311
return;
13051312
}
13061313
}
@@ -1314,6 +1321,8 @@ nfsd4_run_cb_work(struct work_struct *work)
13141321
struct rpc_clnt *clnt;
13151322
int flags;
13161323

1324+
trace_nfsd_cb_work(clp, cb->cb_msg.rpc_proc->p_name);
1325+
13171326
if (cb->cb_need_restart) {
13181327
cb->cb_need_restart = false;
13191328
} else {

‎fs/nfsd/nfs4proc.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ extern void nfs_sb_deactive(struct super_block *sb);
11551155

11561156
#define NFSD42_INTERSSC_MOUNTOPS "vers=4.2,addr=%s,sec=sys"
11571157

1158-
/**
1158+
/*
11591159
* Support one copy source server for now.
11601160
*/
11611161
static __be32
@@ -1245,10 +1245,9 @@ nfsd4_interssc_disconnect(struct vfsmount *ss_mnt)
12451245
mntput(ss_mnt);
12461246
}
12471247

1248-
/**
1249-
* nfsd4_setup_inter_ssc
1250-
*
1248+
/*
12511249
* Verify COPY destination stateid.
1250+
*
12521251
* Connect to the source server with NFSv4.1.
12531252
* Create the source struct file for nfsd_copy_range.
12541253
* Called with COPY cstate:
@@ -2302,6 +2301,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
23022301
}
23032302
check_if_stalefh_allowed(args);
23042303

2304+
rqstp->rq_lease_breaker = (void **)&cstate->clp;
2305+
23052306
trace_nfsd_compound(rqstp, args->opcnt);
23062307
while (!status && resp->opcnt < args->opcnt) {
23072308
op = &args->ops[resp->opcnt++];

0 commit comments

Comments
 (0)