Commit graph

40 commits

Author SHA1 Message Date
Chuck Lever
af8db3370b SUNRPC: Trace calls to .rpc_call_done
[ Upstream commit b40887e10dcacc5e8ae3c1a99dcba20877c4831b ]

Introduce a single tracepoint that can replace simple dprintk call
sites in upper layer "rpc_call_done" callbacks. Example:

   kworker/u24:2-1254  [001]   771.026677: rpc_stats_latency:    task:00000001@00000002 xid=0x16a6f3c0 rpcbindv2 GETPORT backlog=446 rtt=101 execute=555
   kworker/u24:2-1254  [001]   771.026677: rpc_task_call_done:   task:00000001@00000002 flags=ASYNC|DYNAMIC|SOFT|SOFTCONN|SENT runstate=RUNNING|ACTIVE status=0 action=rpcb_getport_done
   kworker/u24:2-1254  [001]   771.026678: rpcb_setport:         task:00000001@00000002 status=0 port=20048

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:47 +01:00
Chuck Lever
e7fce2315c NLM: Fix svcxdr_encode_owner()
[ Upstream commit 89c485c7a3ecbc2ebd568f9c9c2edf3a8cf7485b ]

Dai Ngo reports that, since the XDR overhaul, the NLM server crashes
when the TEST procedure wants to return NLM_DENIED. There is a bug
in svcxdr_encode_owner() that none of our standard test cases found.

Replace the open-coded function with a call to an appropriate
pre-fabricated XDR helper.

Reported-by: Dai Ngo <Dai.Ngo@oracle.com>
Fixes: a6a63ca5652e ("lockd: Common NLM XDR helpers")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:45 +01:00
Chuck Lever
9705fedbeb SUNRPC: Set rq_auth_stat in the pg_authenticate() callout
[ Upstream commit 5c2465dfd457f3015eebcc3ace50570e1d896aeb ]

In a few moments, rq_auth_stat will need to be explicitly set to
rpc_auth_ok before execution gets to the dispatcher.

svc_authenticate() already sets it, but it often gets reset to
rpc_autherr_badcred right after that call, even when authentication
is successful. Let's ensure that the pg_authenticate callout and
svc_set_client() set it properly in every case.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:45 +01:00
J. Bruce Fields
52e3a38ee6 lockd: don't attempt blocking locks on nfs reexports
[ Upstream commit b840be2f00c0bc00d993f8f76e251052b83e4382 ]

As in the v4 case, it doesn't work well to block waiting for a lock on
an nfs filesystem.

As in the v4 case, that means we're depending on the client to poll.
It's probably incorrect to depend on that, but I *think* clients do poll
in practice.  In any case, it's an improvement over hanging the lockd
thread indefinitely as we currently are.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Acked-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:44 +01:00
J. Bruce Fields
1e8208c656 Keep read and write fds with each nlm_file
[ Upstream commit 7f024fcd5c97dc70bb9121c80407cf3cf9be7159 ]

We shouldn't really be using a read-only file descriptor to take a write
lock.

Most filesystems will put up with it.  But NFS, for example, won't.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:44 +01:00
J. Bruce Fields
def72bf393 lockd: update nlm_lookup_file reexport comment
[ Upstream commit b661601a9fdf1af8516e1100de8bba84bd41cca4 ]

Update comment to reflect that we *do* allow reexport, whether it's a
good idea or not....

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:44 +01:00
J. Bruce Fields
c3bb4f2987 nlm: minor refactoring
[ Upstream commit a81041b7d8f08c4e1014173c5483a0f18724a576 ]

Make this lookup slightly more concise, and prepare for changing how we
look this up in a following patch.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:44 +01:00
J. Bruce Fields
5876918c32 nlm: minor nlm_lookup_file argument change
[ Upstream commit 2dc6f19e4f438d4c14987cb17aee38aaf7304e7f ]

It'll come in handy to get the whole nlm_lock.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:44 +01:00
Jia He
02dc2f82d9 lockd: change the proc_handler for nsm_use_hostnames
[ Upstream commit d02a3a2cb25d384005a6e3446a445013342024b7 ]

nsm_use_hostnames is a module parameter and it will be exported to sysctl
procfs. This is to let user sometimes change it from userspace. But the
minimal unit for sysctl procfs read/write it sizeof(int).
In big endian system, the converting from/to  bool to/from int will cause
error for proc items.

This patch use a new proc_handler proc_dobool to fix it.

Signed-off-by: Jia He <hejianet@gmail.com>
Reviewed-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
[thuth: Fix typo in commit message]
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:44 +01:00
Chuck Lever
16d329aa35 lockd: Update the NLMv4 SHARE results encoder to use struct xdr_stream
[ Upstream commit 0ff5b50ab1f7f39862d0cdf6803978d31b27f25e ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
1b0264f47f lockd: Update the NLMv4 nlm_res results encoder to use struct xdr_stream
[ Upstream commit 447c14d48968d0d4c2733c3f8052cb63aa1deb38 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
7375dab4c6 lockd: Update the NLMv4 TEST results encoder to use struct xdr_stream
[ Upstream commit 1beef1473ccaa70a2d54f9e76fba5f534931ea23 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
4d8e7ba426 lockd: Update the NLMv4 void results encoder to use struct xdr_stream
[ Upstream commit ec757e423b4fcd6e5ea4405d1e8243c040458d78 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
9efc217f6d lockd: Update the NLMv4 FREE_ALL arguments decoder to use struct xdr_stream
[ Upstream commit 3049e974a7c7cfa0c15fb807f4a3e75b2ab8517a ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
e7909b9ba1 lockd: Update the NLMv4 SHARE arguments decoder to use struct xdr_stream
[ Upstream commit 7cf96b6d0104b12aa30961901879e428884b1695 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
d64fab4a41 lockd: Update the NLMv4 SM_NOTIFY arguments decoder to use struct xdr_stream
[ Upstream commit bc3665fd718b325cfff3abd383b00d1a87e028dc ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
98c69a73a9 lockd: Update the NLMv4 nlm_res arguments decoder to use struct xdr_stream
[ Upstream commit b4c24b5a41da63e5f3a9b6ea56cbe2a1efe49579 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
3a3447b4d4 lockd: Update the NLMv4 UNLOCK arguments decoder to use struct xdr_stream
[ Upstream commit d76d8c25cea794f65615f3a2324052afa4b5f900 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
0a70771ee5 lockd: Update the NLMv4 CANCEL arguments decoder to use struct xdr_stream
[ Upstream commit 1e1f38dcf3c031715191e1fd26f70a0affca4dbd ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
0c7253b792 lockd: Update the NLMv4 LOCK arguments decoder to use struct xdr_stream
[ Upstream commit 0e5977af4fdc277984fca7d8c2e0c880935775a0 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
01b5a81a2f lockd: Update the NLMv4 TEST arguments decoder to use struct xdr_stream
[ Upstream commit 345b4159a075b15dc4ae70f1db90fa8abf85d2e7 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
432fe02785 lockd: Update the NLMv4 void arguments decoder to use struct xdr_stream
[ Upstream commit 7956521aac58e434a05cf3c68c1b66c1312e5649 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
7c97e91c80 lockd: Update the NLMv1 SHARE results encoder to use struct xdr_stream
[ Upstream commit 529ca3a116e8978575fec061a71fa6865a344891 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:41 +01:00
Chuck Lever
3036deaa22 lockd: Update the NLMv1 nlm_res results encoder to use struct xdr_stream
[ Upstream commit e96735a6980574ecbdb24c760b8d294095e47074 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
dd82c4f837 lockd: Update the NLMv1 TEST results encoder to use struct xdr_stream
[ Upstream commit adf98a4850b9ede9fc174c78a885845fb08499a5 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
f1e34fbfa2 lockd: Update the NLMv1 void results encoder to use struct xdr_stream
[ Upstream commit e26ec898b68b2ab64f379ba0fc0a615b2ad41f40 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
ebeaf81143 lockd: Update the NLMv1 FREE_ALL arguments decoder to use struct xdr_stream
[ Upstream commit 14e105256b9dcdf50a003e2e9a0da77e06770a4b ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
ac378d8d5f lockd: Update the NLMv1 SHARE arguments decoder to use struct xdr_stream
[ Upstream commit 890939e1266b9adf3b0acd5e0385b39813cb8f11 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
fc3b37fbbd lockd: Update the NLMv1 SM_NOTIFY arguments decoder to use struct xdr_stream
[ Upstream commit 137e05e2f735f696e117553f7fa5ef8fb09953e1 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
c05b62d68f lockd: Update the NLMv1 nlm_res arguments decoder to use struct xdr_stream
[ Upstream commit 16ddcabe6240c4fb01c97f6fce6c35ddf8626ad5 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
b0d089d78b lockd: Update the NLMv1 UNLOCK arguments decoder to use struct xdr_stream
[ Upstream commit c27045d302b022ed11d24a2653bceb6af56c6327 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
fb92cd7425 lockd: Update the NLMv1 CANCEL arguments decoder to use struct xdr_stream
[ Upstream commit f4e08f3ac8c4945ea54a740e3afcf44b34e7cf44 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
ec3aa50274 lockd: Update the NLMv1 LOCK arguments decoder to use struct xdr_stream
[ Upstream commit c1adb8c672ca2b085c400695ef064547d77eda29 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
057a92ab02 lockd: Update the NLMv1 TEST arguments decoder to use struct xdr_stream
[ Upstream commit 2fd0c67aabcf0f8821450b00ee511faa0b7761bf ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
6d05ff7c33 lockd: Update the NLMv1 void argument decoder to use struct xdr_stream
[ Upstream commit cc1029b51273da5b342683e9ae14ab4eeaa15997 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
7c020722b0 lockd: Common NLM XDR helpers
[ Upstream commit a6a63ca5652ea05637ecfe349f9e895031529556 ]

Add a .h file containing xdr_stream-based XDR helpers common to both
NLMv3 and NLMv4.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
e9f6e2f26c lockd: Create a simplified .vs_dispatch method for NLM requests
[ Upstream commit a9ad1a8090f58b2ed1774dd0f4c7cdb8210a3793 ]

To enable xdr_stream-based encoding and decoding, create a bespoke
RPC dispatch function for the lockd service.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:40 +01:00
Chuck Lever
dcba979967 SUNRPC: Make trace_svc_process() display the RPC procedure symbolically
[ Upstream commit 2289e87b5951f97783f07fc895e6c5e804b53668 ]

The next few patches will employ these strings to help make server-
side trace logs more human-readable. A similar technique is already
in use in kernel RPC client code.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:28 +01:00
Zheng Yongjun
80d5b3c6cd fs/lockd: convert comma to semicolon
[ Upstream commit 3316fb80a0b4c1fef03a3eb1a7f0651e2133c429 ]

Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:27:28 +01:00
Gabriel2392
7ed7ee9edf Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00