Skip to content

Commit e394ff8

Browse files
committed
Merge tag 'nfsd-6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd updates from Chuck Lever: "Work on 'courteous server', which was introduced in 5.19, continues apace. This release introduces a more flexible limit on the number of NFSv4 clients that NFSD allows, now that NFSv4 clients can remain in courtesy state long after the lease expiration timeout. The client limit is adjusted based on the physical memory size of the server. The NFSD filecache is a cache of files held open by NFSv4 clients or recently touched by NFSv2 or NFSv3 clients. This cache had some significant scalability constraints that have been relieved in this release. Thanks to all who contributed to this work. A data corruption bug found during the most recent NFS bake-a-thon that involves NFSv3 and NFSv4 clients writing the same file has been addressed in this release. This release includes several improvements in CPU scalability for NFSv4 operations. In addition, Neil Brown provided patches that simplify locking during file lookup, creation, rename, and removal that enables subsequent work on making these operations more scalable. We expect to see that work materialize in the next release. There are also numerous single-patch fixes, clean-ups, and the usual improvements in observability" * tag 'nfsd-6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (78 commits) lockd: detect and reject lock arguments that overflow NFSD: discard fh_locked flag and fh_lock/fh_unlock NFSD: use (un)lock_inode instead of fh_(un)lock for file operations NFSD: use explicit lock/unlock for directory ops NFSD: reduce locking in nfsd_lookup() NFSD: only call fh_unlock() once in nfsd_link() NFSD: always drop directory lock in nfsd_unlink() NFSD: change nfsd_create()/nfsd_symlink() to unlock directory before returning. NFSD: add posix ACLs to struct nfsd_attrs NFSD: add security label to struct nfsd_attrs NFSD: set attributes when creating symlinks NFSD: introduce struct nfsd_attrs NFSD: verify the opened dentry after setting a delegation NFSD: drop fh argument from alloc_init_deleg NFSD: Move copy offload callback arguments into a separate structure NFSD: Add nfsd4_send_cb_offload() NFSD: Remove kmalloc from nfsd4_do_async_copy() NFSD: Refactor nfsd4_do_copy() NFSD: Refactor nfsd4_cleanup_inter_ssc() (2/2) NFSD: Refactor nfsd4_cleanup_inter_ssc() (1/2) ...
2 parents 15205c2 + 6930bcb commit e394ff8

33 files changed

+1426
-945
lines changed

Documentation/fault-injection/fault-injection.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@ configuration of fault-injection capabilities.
169169
default is 'N', setting it to 'Y' will disable disconnect
170170
injection on the RPC server.
171171

172+
- /sys/kernel/debug/fail_sunrpc/ignore-cache-wait:
173+
174+
Format: { 'Y' | 'N' }
175+
176+
default is 'N', setting it to 'Y' will disable cache wait
177+
injection on the RPC server.
178+
172179
- /sys/kernel/debug/fail_function/inject:
173180

174181
Format: { 'function-name' | '!function-name' | '' }

fs/lockd/svc4proc.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
3232
if (!nlmsvc_ops)
3333
return nlm_lck_denied_nolocks;
3434

35+
if (lock->lock_start > OFFSET_MAX ||
36+
(lock->lock_len && ((lock->lock_len - 1) > (OFFSET_MAX - lock->lock_start))))
37+
return nlm4_fbig;
38+
3539
/* Obtain host handle */
3640
if (!(host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len))
3741
|| (argp->monitor && nsm_monitor(host) < 0))
@@ -50,6 +54,10 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
5054
/* Set up the missing parts of the file_lock structure */
5155
lock->fl.fl_file = file->f_file[mode];
5256
lock->fl.fl_pid = current->tgid;
57+
lock->fl.fl_start = (loff_t)lock->lock_start;
58+
lock->fl.fl_end = lock->lock_len ?
59+
(loff_t)(lock->lock_start + lock->lock_len - 1) :
60+
OFFSET_MAX;
5361
lock->fl.fl_lmops = &nlmsvc_lock_operations;
5462
nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);
5563
if (!lock->fl.fl_owner) {
@@ -87,6 +95,7 @@ __nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
8795
struct nlm_args *argp = rqstp->rq_argp;
8896
struct nlm_host *host;
8997
struct nlm_file *file;
98+
struct nlm_lockowner *test_owner;
9099
__be32 rc = rpc_success;
91100

92101
dprintk("lockd: TEST4 called\n");
@@ -96,14 +105,15 @@ __nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
96105
if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
97106
return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
98107

108+
test_owner = argp->lock.fl.fl_owner;
99109
/* Now check for conflicting locks */
100110
resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie);
101111
if (resp->status == nlm_drop_reply)
102112
rc = rpc_drop_reply;
103113
else
104114
dprintk("lockd: TEST4 status %d\n", ntohl(resp->status));
105115

106-
nlmsvc_release_lockowner(&argp->lock);
116+
nlmsvc_put_lockowner(test_owner);
107117
nlmsvc_release_host(host);
108118
nlm_release_file(file);
109119
return rc;

fs/lockd/svclock.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ nlmsvc_get_lockowner(struct nlm_lockowner *lockowner)
340340
return lockowner;
341341
}
342342

343-
static void nlmsvc_put_lockowner(struct nlm_lockowner *lockowner)
343+
void nlmsvc_put_lockowner(struct nlm_lockowner *lockowner)
344344
{
345345
if (!refcount_dec_and_lock(&lockowner->count, &lockowner->host->h_lock))
346346
return;
@@ -590,7 +590,6 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
590590
int error;
591591
int mode;
592592
__be32 ret;
593-
struct nlm_lockowner *test_owner;
594593

595594
dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n",
596595
nlmsvc_file_inode(file)->i_sb->s_id,
@@ -604,9 +603,6 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
604603
goto out;
605604
}
606605

607-
/* If there's a conflicting lock, remember to clean up the test lock */
608-
test_owner = (struct nlm_lockowner *)lock->fl.fl_owner;
609-
610606
mode = lock_to_openmode(&lock->fl);
611607
error = vfs_test_lock(file->f_file[mode], &lock->fl);
612608
if (error) {
@@ -635,10 +631,6 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
635631
conflock->fl.fl_end = lock->fl.fl_end;
636632
locks_release_private(&lock->fl);
637633

638-
/* Clean up the test lock */
639-
lock->fl.fl_owner = NULL;
640-
nlmsvc_put_lockowner(test_owner);
641-
642634
ret = nlm_lck_denied;
643635
out:
644636
return ret;

fs/lockd/svcproc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ __nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
116116
struct nlm_args *argp = rqstp->rq_argp;
117117
struct nlm_host *host;
118118
struct nlm_file *file;
119+
struct nlm_lockowner *test_owner;
119120
__be32 rc = rpc_success;
120121

121122
dprintk("lockd: TEST called\n");
@@ -125,6 +126,8 @@ __nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
125126
if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
126127
return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
127128

129+
test_owner = argp->lock.fl.fl_owner;
130+
128131
/* Now check for conflicting locks */
129132
resp->status = cast_status(nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie));
130133
if (resp->status == nlm_drop_reply)
@@ -133,7 +136,7 @@ __nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
133136
dprintk("lockd: TEST status %d vers %d\n",
134137
ntohl(resp->status), rqstp->rq_vers);
135138

136-
nlmsvc_release_lockowner(&argp->lock);
139+
nlmsvc_put_lockowner(test_owner);
137140
nlmsvc_release_host(host);
138141
nlm_release_file(file);
139142
return rc;

fs/lockd/xdr4.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@
2020

2121
#include "svcxdr.h"
2222

23-
static inline loff_t
24-
s64_to_loff_t(__s64 offset)
25-
{
26-
return (loff_t)offset;
27-
}
28-
29-
3023
static inline s64
3124
loff_t_to_s64(loff_t offset)
3225
{
@@ -70,8 +63,6 @@ static bool
7063
svcxdr_decode_lock(struct xdr_stream *xdr, struct nlm_lock *lock)
7164
{
7265
struct file_lock *fl = &lock->fl;
73-
u64 len, start;
74-
s64 end;
7566

7667
if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len))
7768
return false;
@@ -81,20 +72,14 @@ svcxdr_decode_lock(struct xdr_stream *xdr, struct nlm_lock *lock)
8172
return false;
8273
if (xdr_stream_decode_u32(xdr, &lock->svid) < 0)
8374
return false;
84-
if (xdr_stream_decode_u64(xdr, &start) < 0)
75+
if (xdr_stream_decode_u64(xdr, &lock->lock_start) < 0)
8576
return false;
86-
if (xdr_stream_decode_u64(xdr, &len) < 0)
77+
if (xdr_stream_decode_u64(xdr, &lock->lock_len) < 0)
8778
return false;
8879

8980
locks_init_lock(fl);
9081
fl->fl_flags = FL_POSIX;
9182
fl->fl_type = F_RDLCK;
92-
end = start + len - 1;
93-
fl->fl_start = s64_to_loff_t(start);
94-
if (len == 0 || end < 0)
95-
fl->fl_end = OFFSET_MAX;
96-
else
97-
fl->fl_end = s64_to_loff_t(end);
9883

9984
return true;
10085
}

fs/nfsd/acl.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,16 @@
3838
struct nfs4_acl;
3939
struct svc_fh;
4040
struct svc_rqst;
41+
struct nfsd_attrs;
42+
enum nfs_ftype4;
4143

4244
int nfs4_acl_bytes(int entries);
4345
int nfs4_acl_get_whotype(char *, u32);
4446
__be32 nfs4_acl_write_who(struct xdr_stream *xdr, int who);
4547

4648
int nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry,
4749
struct nfs4_acl **acl);
48-
__be32 nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp,
49-
struct nfs4_acl *acl);
50+
__be32 nfsd4_acl_to_attr(enum nfs_ftype4 type, struct nfs4_acl *acl,
51+
struct nfsd_attrs *attr);
5052

5153
#endif /* LINUX_NFS4_ACL_H */

0 commit comments

Comments
 (0)