Skip to content

Commit 99d9982

Browse files
committed
Merge tag 'nfs-for-6.6-1' of git://git.linux-nfs.org/projects/anna/linux-nfs
Pull NFS client updates from Anna Schumaker: "New Features: - Enable the NFS v4.2 READ_PLUS operation by default Stable Fixes: - NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info - NFS: Fix a potential data corruption Bugfixes: - Fix various READ_PLUS issues including: - smatch warnings - xdr size calculations - scratch buffer handling - 32bit / highmem xdr page handling - Fix checkpatch errors in file.c - Fix redundant readdir request after an EOF - Fix handling of COPY ERR_OFFLOAD_NO_REQ - Fix assignment of xprtdata.cred Cleanups: - Remove unused xprtrdma function declarations - Clean up an integer overflow check to avoid a warning - Clean up #includes in dns_resolve.c - Clean up nfs4_get_device_info so we don't pass a NULL pointer to __free_page() - Clean up sunrpc TCP socket timeout configuration - Guard against READDIR loops when entry names are too long - Use EXCHID4_FLAG_USE_PNFS_DS for DS servers" * tag 'nfs-for-6.6-1' of git://git.linux-nfs.org/projects/anna/linux-nfs: (22 commits) pNFS: Fix assignment of xprtdata.cred NFSv4.2: fix handling of COPY ERR_OFFLOAD_NO_REQ NFS: Guard against READDIR loop when entry names exceed MAXNAMELEN NFSv4.1: use EXCHGID4_FLAG_USE_PNFS_DS for DS server NFS/pNFS: Set the connect timeout for the pNFS flexfiles driver SUNRPC: Don't override connect timeouts in rpc_clnt_add_xprt() SUNRPC: Allow specification of TCP client connect timeout at setup SUNRPC: Refactor and simplify connect timeout SUNRPC: Set the TCP_SYNCNT to match the socket timeout NFS: Fix a potential data corruption nfs: fix redundant readdir request after get eof nfs/blocklayout: Use the passed in gfp flags filemap: Fix errors in file.c NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info NFS: Move common includes outside ifdef SUNRPC: clean up integer overflow check xprtrdma: Remove unused function declaration rpcrdma_bc_post_recv() NFS: Enable the READ_PLUS operation by default SUNRPC: kmap() the xdr pages during decode NFSv4.2: Rework scratch handling for READ_PLUS (again) ...
2 parents f35d170 + c4a123d commit 99d9982

File tree

27 files changed

+171
-63
lines changed

27 files changed

+171
-63
lines changed

fs/nfs/Kconfig

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,6 @@ config NFS_DISABLE_UDP_SUPPORT
209209
config NFS_V4_2_READ_PLUS
210210
bool "NFS: Enable support for the NFSv4.2 READ_PLUS operation"
211211
depends on NFS_V4_2
212-
default n
212+
default y
213213
help
214-
This is intended for developers only. The READ_PLUS operation has
215-
been shown to have issues under specific conditions and should not
216-
be used in production.
214+
Choose Y here to enable use of the NFS v4.2 READ_PLUS operation.

fs/nfs/blocklayout/dev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ bl_parse_concat(struct nfs_server *server, struct pnfs_block_dev *d,
404404
int ret, i;
405405

406406
d->children = kcalloc(v->concat.volumes_count,
407-
sizeof(struct pnfs_block_dev), GFP_KERNEL);
407+
sizeof(struct pnfs_block_dev), gfp_mask);
408408
if (!d->children)
409409
return -ENOMEM;
410410

@@ -433,7 +433,7 @@ bl_parse_stripe(struct nfs_server *server, struct pnfs_block_dev *d,
433433
int ret, i;
434434

435435
d->children = kcalloc(v->stripe.volumes_count,
436-
sizeof(struct pnfs_block_dev), GFP_KERNEL);
436+
sizeof(struct pnfs_block_dev), gfp_mask);
437437
if (!d->children)
438438
return -ENOMEM;
439439

fs/nfs/client.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,8 @@ int nfs_create_rpc_client(struct nfs_client *clp,
517517
.authflavor = flavor,
518518
.cred = cl_init->cred,
519519
.xprtsec = cl_init->xprtsec,
520+
.connect_timeout = cl_init->connect_timeout,
521+
.reconnect_timeout = cl_init->reconnect_timeout,
520522
};
521523

522524
if (test_bit(NFS_CS_DISCRTRY, &clp->cl_flags))

fs/nfs/dir.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,17 @@ static void nfs_do_filldir(struct nfs_readdir_descriptor *desc,
10891089
for (i = desc->cache_entry_index; i < array->size; i++) {
10901090
struct nfs_cache_array_entry *ent;
10911091

1092+
/*
1093+
* nfs_readdir_handle_cache_misses return force clear at
1094+
* (cache_misses > NFS_READDIR_CACHE_MISS_THRESHOLD) for
1095+
* readdir heuristic, NFS_READDIR_CACHE_MISS_THRESHOLD + 1
1096+
* entries need be emitted here.
1097+
*/
1098+
if (first_emit && i > NFS_READDIR_CACHE_MISS_THRESHOLD + 2) {
1099+
desc->eob = true;
1100+
break;
1101+
}
1102+
10921103
ent = &array->array[i];
10931104
if (!dir_emit(desc->ctx, ent->name, ent->name_len,
10941105
nfs_compat_user_ino64(ent->ino), ent->d_type)) {
@@ -1107,10 +1118,6 @@ static void nfs_do_filldir(struct nfs_readdir_descriptor *desc,
11071118
desc->ctx->pos = desc->dir_cookie;
11081119
else
11091120
desc->ctx->pos++;
1110-
if (first_emit && i > NFS_READDIR_CACHE_MISS_THRESHOLD + 1) {
1111-
desc->eob = true;
1112-
break;
1113-
}
11141121
}
11151122
if (array->folio_is_eof)
11161123
desc->eof = !desc->eob;

fs/nfs/direct.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,13 +472,31 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter,
472472
return result;
473473
}
474474

475+
static void nfs_direct_add_page_head(struct list_head *list,
476+
struct nfs_page *req)
477+
{
478+
struct nfs_page *head = req->wb_head;
479+
480+
if (!list_empty(&head->wb_list) || !nfs_lock_request(head))
481+
return;
482+
if (!list_empty(&head->wb_list)) {
483+
nfs_unlock_request(head);
484+
return;
485+
}
486+
list_add(&head->wb_list, list);
487+
kref_get(&head->wb_kref);
488+
kref_get(&head->wb_kref);
489+
}
490+
475491
static void nfs_direct_join_group(struct list_head *list, struct inode *inode)
476492
{
477493
struct nfs_page *req, *subreq;
478494

479495
list_for_each_entry(req, list, wb_list) {
480-
if (req->wb_head != req)
496+
if (req->wb_head != req) {
497+
nfs_direct_add_page_head(&req->wb_list, req);
481498
continue;
499+
}
482500
subreq = req->wb_this_page;
483501
if (subreq == req)
484502
continue;

fs/nfs/dns_resolve.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
* Resolves DNS hostnames into valid ip addresses
88
*/
99

10-
#ifdef CONFIG_NFS_USE_KERNEL_DNS
11-
1210
#include <linux/module.h>
1311
#include <linux/sunrpc/clnt.h>
1412
#include <linux/sunrpc/addr.h>
15-
#include <linux/dns_resolver.h>
13+
1614
#include "dns_resolve.h"
1715

16+
#ifdef CONFIG_NFS_USE_KERNEL_DNS
17+
18+
#include <linux/dns_resolver.h>
19+
1820
ssize_t nfs_dns_resolve_name(struct net *net, char *name, size_t namelen,
1921
struct sockaddr_storage *ss, size_t salen)
2022
{
@@ -35,23 +37,19 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name, size_t namelen,
3537

3638
#else
3739

38-
#include <linux/module.h>
3940
#include <linux/hash.h>
4041
#include <linux/string.h>
4142
#include <linux/kmod.h>
4243
#include <linux/slab.h>
4344
#include <linux/socket.h>
4445
#include <linux/seq_file.h>
4546
#include <linux/inet.h>
46-
#include <linux/sunrpc/clnt.h>
47-
#include <linux/sunrpc/addr.h>
4847
#include <linux/sunrpc/cache.h>
4948
#include <linux/sunrpc/svcauth.h>
5049
#include <linux/sunrpc/rpc_pipe_fs.h>
5150
#include <linux/nfs_fs.h>
5251

5352
#include "nfs4_fs.h"
54-
#include "dns_resolve.h"
5553
#include "cache_lib.h"
5654
#include "netns.h"
5755

fs/nfs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ nfs_file_splice_read(struct file *in, loff_t *ppos, struct pipe_inode_info *pipe
200200
EXPORT_SYMBOL_GPL(nfs_file_splice_read);
201201

202202
int
203-
nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
203+
nfs_file_mmap(struct file *file, struct vm_area_struct *vma)
204204
{
205205
struct inode *inode = file_inode(file);
206206
int status;

fs/nfs/internal.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ struct nfs_client_initdata {
8282
const struct rpc_timeout *timeparms;
8383
const struct cred *cred;
8484
struct xprtsec_parms xprtsec;
85+
unsigned long connect_timeout;
86+
unsigned long reconnect_timeout;
8587
};
8688

8789
/*
@@ -493,6 +495,7 @@ extern const struct nfs_pgio_completion_ops nfs_async_read_completion_ops;
493495
extern void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,
494496
struct inode *inode, bool force_mds,
495497
const struct nfs_pgio_completion_ops *compl_ops);
498+
extern bool nfs_read_alloc_scratch(struct nfs_pgio_header *hdr, size_t size);
496499
extern int nfs_read_add_folio(struct nfs_pageio_descriptor *pgio,
497500
struct nfs_open_context *ctx,
498501
struct folio *folio);

fs/nfs/nfs2xdr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ int nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
949949

950950
error = decode_filename_inline(xdr, &entry->name, &entry->len);
951951
if (unlikely(error))
952-
return -EAGAIN;
952+
return error == -ENAMETOOLONG ? -ENAMETOOLONG : -EAGAIN;
953953

954954
/*
955955
* The type (size and byte order) of nfscookie isn't defined in

fs/nfs/nfs3client.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ struct nfs_client *nfs3_set_ds_client(struct nfs_server *mds_srv,
8686
int ds_proto, unsigned int ds_timeo, unsigned int ds_retrans)
8787
{
8888
struct rpc_timeout ds_timeout;
89+
unsigned long connect_timeout = ds_timeo * (ds_retrans + 1) * HZ / 10;
8990
struct nfs_client *mds_clp = mds_srv->nfs_client;
9091
struct nfs_client_initdata cl_init = {
9192
.addr = ds_addr,
@@ -98,6 +99,8 @@ struct nfs_client *nfs3_set_ds_client(struct nfs_server *mds_srv,
9899
.timeparms = &ds_timeout,
99100
.cred = mds_srv->cred,
100101
.xprtsec = mds_clp->cl_xprtsec,
102+
.connect_timeout = connect_timeout,
103+
.reconnect_timeout = connect_timeout,
101104
};
102105
struct nfs_client *clp;
103106
char buf[INET6_ADDRSTRLEN + 1];

0 commit comments

Comments
 (0)