Skip to content

Commit 1da3854

Browse files
committed
Merge tag 'nfsd-5.15-3' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd fixes from Chuck Lever: "Bug fixes for NFSD error handling paths" * tag 'nfsd-5.15-3' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: NFSD: Keep existing listeners on portlist error SUNRPC: fix sign error causing rpcsec_gss drops nfsd: Fix a warning for nfsd_file_close_inode nfsd4: Handle the NFSv4 READDIR 'dircount' hint being zero nfsd: fix error handling of register_pernet_subsys() in init_nfsd()
2 parents 3e899c7 + c201069 commit 1da3854

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

fs/nfsd/filecache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ nfsd_file_close_inode_sync(struct inode *inode)
542542
}
543543

544544
/**
545-
* nfsd_file_close_inode_sync - attempt to forcibly close a nfsd_file
545+
* nfsd_file_close_inode - attempt a delayed close of a nfsd_file
546546
* @inode: inode of the file to attempt to remove
547547
*
548548
* Walk the whole hash bucket, looking for any files that correspond to "inode".

fs/nfsd/nfs4xdr.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3544,15 +3544,18 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
35443544
goto fail;
35453545
cd->rd_maxcount -= entry_bytes;
35463546
/*
3547-
* RFC 3530 14.2.24 describes rd_dircount as only a "hint", so
3548-
* let's always let through the first entry, at least:
3547+
* RFC 3530 14.2.24 describes rd_dircount as only a "hint", and
3548+
* notes that it could be zero. If it is zero, then the server
3549+
* should enforce only the rd_maxcount value.
35493550
*/
3550-
if (!cd->rd_dircount)
3551-
goto fail;
3552-
name_and_cookie = 4 + 4 * XDR_QUADLEN(namlen) + 8;
3553-
if (name_and_cookie > cd->rd_dircount && cd->cookie_offset)
3554-
goto fail;
3555-
cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie);
3551+
if (cd->rd_dircount) {
3552+
name_and_cookie = 4 + 4 * XDR_QUADLEN(namlen) + 8;
3553+
if (name_and_cookie > cd->rd_dircount && cd->cookie_offset)
3554+
goto fail;
3555+
cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie);
3556+
if (!cd->rd_dircount)
3557+
cd->rd_maxcount = 0;
3558+
}
35563559

35573560
cd->cookie_offset = cookie_offset;
35583561
skip_entry:

fs/nfsd/nfsctl.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,10 @@ static ssize_t __write_ports_addxprt(char *buf, struct net *net, const struct cr
793793
svc_xprt_put(xprt);
794794
}
795795
out_err:
796-
nfsd_destroy(net);
796+
if (!list_empty(&nn->nfsd_serv->sv_permsocks))
797+
nn->nfsd_serv->sv_nrthreads--;
798+
else
799+
nfsd_destroy(net);
797800
return err;
798801
}
799802

@@ -1545,7 +1548,7 @@ static int __init init_nfsd(void)
15451548
goto out_free_all;
15461549
return 0;
15471550
out_free_all:
1548-
unregister_pernet_subsys(&nfsd_net_ops);
1551+
unregister_filesystem(&nfsd_fs_type);
15491552
out_free_exports:
15501553
remove_proc_entry("fs/nfs/exports", NULL);
15511554
remove_proc_entry("fs/nfs", NULL);

net/sunrpc/auth_gss/svcauth_gss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ static bool gss_check_seq_num(const struct svc_rqst *rqstp, struct rsc *rsci,
645645
}
646646
__set_bit(seq_num % GSS_SEQ_WIN, sd->sd_win);
647647
goto ok;
648-
} else if (seq_num <= sd->sd_max - GSS_SEQ_WIN) {
648+
} else if (seq_num + GSS_SEQ_WIN <= sd->sd_max) {
649649
goto toolow;
650650
}
651651
if (__test_and_set_bit(seq_num % GSS_SEQ_WIN, sd->sd_win))

0 commit comments

Comments
 (0)