Skip to content

Commit 18ba603

Browse files
committed
Merge tag 'nfsd-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd updates from Chuck Lever: "Notable features of this release include: - Pre-requisites for automatically determining the RPC server thread count - Clean-up and preparation for supporting LOCALIO, which will be merged via the NFS client tree - Enhancements and fixes to NFSv4.2 COPY offload - A new Python-based tool for generating kernel SunRPC XDR encoding and decoding functions, added as an aid for prototyping features in protocols based on the Linux kernel's SunRPC implementation As always I am grateful to the NFSD contributors, reviewers, testers, and bug reporters who participated during this cycle" * tag 'nfsd-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (57 commits) xdrgen: Prevent reordering of encoder and decoder functions xdrgen: typedefs should use the built-in string and opaque functions xdrgen: Fix return code checking in built-in XDR decoders tools: Add xdrgen nfsd: fix delegation_blocked() to block correctly for at least 30 seconds nfsd: fix initial getattr on write delegation nfsd: untangle code in nfsd4_deleg_getattr_conflict() nfsd: enforce upper limit for namelen in __cld_pipe_inprogress_downcall() nfsd: return -EINVAL when namelen is 0 NFSD: Wrap async copy operations with trace points NFSD: Clean up extra whitespace in trace_nfsd_copy_done NFSD: Record the callback stateid in copy tracepoints NFSD: Display copy stateids with conventional print formatting NFSD: Limit the number of concurrent async COPY operations NFSD: Async COPY result needs to return a write verifier nfsd: avoid races with wake_up_var() nfsd: use clear_and_wake_up_bit() sunrpc: xprtrdma: Use ERR_CAST() to return NFSD: Annotate struct pnfs_block_deviceaddr with __counted_by() nfsd: call cache_put if xdr_reserve_space returns NULL ...
2 parents 721068d + 509abfc commit 18ba603

File tree

200 files changed

+4955
-495
lines changed

Some content is hidden

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

200 files changed

+4955
-495
lines changed

.mailmap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ Christian Brauner <[email protected]> <[email protected]>
154154
Christian Marangi <[email protected]>
155155
Christophe Ricard <[email protected]>
156156
Christoph Hellwig <[email protected]>
157+
158+
159+
157160
158161
159162
Corey Minyard <[email protected]>

fs/lockd/host.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ nlm_bind_host(struct nlm_host *host)
440440
if ((clnt = host->h_rpcclnt) != NULL) {
441441
nlm_rebind_host(host);
442442
} else {
443-
unsigned long increment = nlmsvc_timeout;
443+
unsigned long increment = nlm_timeout * HZ;
444444
struct rpc_timeout timeparms = {
445445
.to_initval = increment,
446446
.to_increment = increment,

fs/lockd/svc.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ EXPORT_SYMBOL_GPL(nlmsvc_ops);
5353
static DEFINE_MUTEX(nlmsvc_mutex);
5454
static unsigned int nlmsvc_users;
5555
static struct svc_serv *nlmsvc_serv;
56-
unsigned long nlmsvc_timeout;
5756

5857
static void nlmsvc_request_retry(struct timer_list *tl)
5958
{
@@ -68,7 +67,7 @@ unsigned int lockd_net_id;
6867
* and also changed through the sysctl interface. -- Jamie Lokier, Aug 2003
6968
*/
7069
static unsigned long nlm_grace_period;
71-
static unsigned long nlm_timeout = LOCKD_DFLT_TIMEO;
70+
unsigned long nlm_timeout = LOCKD_DFLT_TIMEO;
7271
static int nlm_udpport, nlm_tcpport;
7372

7473
/* RLIM_NOFILE defaults to 1024. That seems like a reasonable default here. */
@@ -125,6 +124,8 @@ lockd(void *vrqstp)
125124
struct net *net = &init_net;
126125
struct lockd_net *ln = net_generic(net, lockd_net_id);
127126

127+
svc_thread_init_status(rqstp, 0);
128+
128129
/* try_to_freeze() is called from svc_recv() */
129130
set_freezable();
130131

@@ -333,10 +334,6 @@ static int lockd_get(void)
333334
printk(KERN_WARNING
334335
"lockd_up: no pid, %d users??\n", nlmsvc_users);
335336

336-
if (!nlm_timeout)
337-
nlm_timeout = LOCKD_DFLT_TIMEO;
338-
nlmsvc_timeout = nlm_timeout * HZ;
339-
340337
serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, lockd);
341338
if (!serv) {
342339
printk(KERN_WARNING "lockd_up: create service failed\n");

fs/nfs/callback.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ nfs4_callback_svc(void *vrqstp)
7676
{
7777
struct svc_rqst *rqstp = vrqstp;
7878

79+
svc_thread_init_status(rqstp, 0);
80+
7981
set_freezable();
8082

8183
while (!svc_thread_should_stop(rqstp))

fs/nfsd/auth.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@
55
#include "nfsd.h"
66
#include "auth.h"
77

8-
int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp)
8+
int nfsexp_flags(struct svc_cred *cred, struct svc_export *exp)
99
{
1010
struct exp_flavor_info *f;
1111
struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors;
1212

1313
for (f = exp->ex_flavors; f < end; f++) {
14-
if (f->pseudoflavor == rqstp->rq_cred.cr_flavor)
14+
if (f->pseudoflavor == cred->cr_flavor)
1515
return f->flags;
1616
}
1717
return exp->ex_flags;
1818

1919
}
2020

21-
int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
21+
int nfsd_setuser(struct svc_cred *cred, struct svc_export *exp)
2222
{
2323
struct group_info *rqgi;
2424
struct group_info *gi;
2525
struct cred *new;
2626
int i;
27-
int flags = nfsexp_flags(rqstp, exp);
27+
int flags = nfsexp_flags(cred, exp);
2828

2929
/* discard any old override before preparing the new set */
3030
revert_creds(get_cred(current_real_cred()));
3131
new = prepare_creds();
3232
if (!new)
3333
return -ENOMEM;
3434

35-
new->fsuid = rqstp->rq_cred.cr_uid;
36-
new->fsgid = rqstp->rq_cred.cr_gid;
35+
new->fsuid = cred->cr_uid;
36+
new->fsgid = cred->cr_gid;
3737

38-
rqgi = rqstp->rq_cred.cr_group_info;
38+
rqgi = cred->cr_group_info;
3939

4040
if (flags & NFSEXP_ALLSQUASH) {
4141
new->fsuid = exp->ex_anon_uid;

fs/nfsd/auth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
* Set the current process's fsuid/fsgid etc to those of the NFS
1313
* client user
1414
*/
15-
int nfsd_setuser(struct svc_rqst *, struct svc_export *);
15+
int nfsd_setuser(struct svc_cred *cred, struct svc_export *exp);
1616

1717
#endif /* LINUX_NFSD_AUTH_H */

fs/nfsd/blocklayout.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ nfsd4_block_get_device_info_simple(struct super_block *sb,
147147
struct pnfs_block_deviceaddr *dev;
148148
struct pnfs_block_volume *b;
149149

150-
dev = kzalloc(sizeof(struct pnfs_block_deviceaddr) +
151-
sizeof(struct pnfs_block_volume), GFP_KERNEL);
150+
dev = kzalloc(struct_size(dev, volumes, 1), GFP_KERNEL);
152151
if (!dev)
153152
return -ENOMEM;
154153
gdp->gd_device = dev;
@@ -255,8 +254,7 @@ nfsd4_block_get_device_info_scsi(struct super_block *sb,
255254
const struct pr_ops *ops;
256255
int ret;
257256

258-
dev = kzalloc(sizeof(struct pnfs_block_deviceaddr) +
259-
sizeof(struct pnfs_block_volume), GFP_KERNEL);
257+
dev = kzalloc(struct_size(dev, volumes, 1), GFP_KERNEL);
260258
if (!dev)
261259
return -ENOMEM;
262260
gdp->gd_device = dev;

fs/nfsd/blocklayoutxdr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct pnfs_block_volume {
4747

4848
struct pnfs_block_deviceaddr {
4949
u32 nr_volumes;
50-
struct pnfs_block_volume volumes[];
50+
struct pnfs_block_volume volumes[] __counted_by(nr_volumes);
5151
};
5252

5353
__be32 nfsd4_block_encode_getdeviceinfo(struct xdr_stream *xdr,

fs/nfsd/cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define NFSCACHE_H
1111

1212
#include <linux/sunrpc/svc.h>
13-
#include "netns.h"
13+
#include "nfsd.h"
1414

1515
/*
1616
* Representation of a reply cache entry.

fs/nfsd/export.c

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp)
11211121
return 0;
11221122

11231123
denied:
1124-
return rqstp->rq_vers < 4 ? nfserr_acces : nfserr_wrongsec;
1124+
return nfserr_wrongsec;
11251125
}
11261126

11271127
/*
@@ -1164,19 +1164,35 @@ rqst_exp_get_by_name(struct svc_rqst *rqstp, struct path *path)
11641164
return gssexp;
11651165
}
11661166

1167+
/**
1168+
* rqst_exp_find - Find an svc_export in the context of a rqst or similar
1169+
* @reqp: The handle to be used to suspend the request if a cache-upcall is needed
1170+
* If NULL, missing in-cache information will result in failure.
1171+
* @net: The network namespace in which the request exists
1172+
* @cl: default auth_domain to use for looking up the export
1173+
* @gsscl: an alternate auth_domain defined using deprecated gss/krb5 format.
1174+
* @fsid_type: The type of fsid to look for
1175+
* @fsidv: The actual fsid to look up in the context of either client.
1176+
*
1177+
* Perform a lookup for @cl/@fsidv in the given @net for an export. If
1178+
* none found and @gsscl specified, repeat the lookup.
1179+
*
1180+
* Returns an export, or an error pointer.
1181+
*/
11671182
struct svc_export *
1168-
rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
1183+
rqst_exp_find(struct cache_req *reqp, struct net *net,
1184+
struct auth_domain *cl, struct auth_domain *gsscl,
1185+
int fsid_type, u32 *fsidv)
11691186
{
1187+
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
11701188
struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
1171-
struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
11721189
struct cache_detail *cd = nn->svc_export_cache;
11731190

1174-
if (rqstp->rq_client == NULL)
1191+
if (!cl)
11751192
goto gss;
11761193

11771194
/* First try the auth_unix client: */
1178-
exp = exp_find(cd, rqstp->rq_client, fsid_type,
1179-
fsidv, &rqstp->rq_chandle);
1195+
exp = exp_find(cd, cl, fsid_type, fsidv, reqp);
11801196
if (PTR_ERR(exp) == -ENOENT)
11811197
goto gss;
11821198
if (IS_ERR(exp))
@@ -1186,10 +1202,9 @@ rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
11861202
return exp;
11871203
gss:
11881204
/* Otherwise, try falling back on gss client */
1189-
if (rqstp->rq_gssclient == NULL)
1205+
if (!gsscl)
11901206
return exp;
1191-
gssexp = exp_find(cd, rqstp->rq_gssclient, fsid_type, fsidv,
1192-
&rqstp->rq_chandle);
1207+
gssexp = exp_find(cd, gsscl, fsid_type, fsidv, reqp);
11931208
if (PTR_ERR(gssexp) == -ENOENT)
11941209
return exp;
11951210
if (!IS_ERR(exp))
@@ -1220,7 +1235,9 @@ struct svc_export *rqst_find_fsidzero_export(struct svc_rqst *rqstp)
12201235

12211236
mk_fsid(FSID_NUM, fsidv, 0, 0, 0, NULL);
12221237

1223-
return rqst_exp_find(rqstp, FSID_NUM, fsidv);
1238+
return rqst_exp_find(&rqstp->rq_chandle, SVC_NET(rqstp),
1239+
rqstp->rq_client, rqstp->rq_gssclient,
1240+
FSID_NUM, fsidv);
12241241
}
12251242

12261243
/*

0 commit comments

Comments
 (0)