Skip to content

Commit 92cadfc

Browse files
committed
Merge tag 'nfsd-6.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd fixes from Chuck Lever: - Protect NFSD writes against filesystem freezing - Fix a potential memory leak during server shutdown * tag 'nfsd-6.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: SUNRPC: Fix a server shutdown leak NFSD: Protect against filesystem freezing
2 parents ae195ca + 9ca6705 commit 92cadfc

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

fs/nfsd/vfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,9 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct nfsd_file *nf,
11041104
since = READ_ONCE(file->f_wb_err);
11051105
if (verf)
11061106
nfsd_copy_write_verifier(verf, nn);
1107+
file_start_write(file);
11071108
host_err = vfs_iter_write(file, &iter, &pos, flags);
1109+
file_end_write(file);
11081110
if (host_err < 0) {
11091111
nfsd_reset_write_verifier(nn);
11101112
trace_nfsd_writeverf_reset(nn, rqstp, host_err);

net/sunrpc/svc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ svc_start_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
798798
static int
799799
svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
800800
{
801+
struct svc_rqst *rqstp;
801802
struct task_struct *task;
802803
unsigned int state = serv->sv_nrthreads-1;
803804

@@ -806,7 +807,10 @@ svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
806807
task = choose_victim(serv, pool, &state);
807808
if (task == NULL)
808809
break;
809-
kthread_stop(task);
810+
rqstp = kthread_data(task);
811+
/* Did we lose a race to svo_function threadfn? */
812+
if (kthread_stop(task) == -EINTR)
813+
svc_exit_thread(rqstp);
810814
nrservs++;
811815
} while (nrservs < 0);
812816
return 0;

0 commit comments

Comments
 (0)