Skip to content

Commit 88808fb

Browse files
committed
Merge tag 'nfsd-5.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd fixes from Chuck Lever: "Notable bug fixes: - Ensure SM_NOTIFY doesn't crash the NFS server host - Ensure NLM locks are cleaned up after client reboot - Fix a leak of internal NFSv4 lease information" * tag 'nfsd-5.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: nfsd: nfsd4_setclientid_confirm mistakenly expires confirmed client. lockd: fix failure to cleanup client locks lockd: fix server crash on reboot of client holding lock
2 parents d5084ff + ab451ea commit 88808fb

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

fs/lockd/svcsubs.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,19 +179,21 @@ nlm_delete_file(struct nlm_file *file)
179179
static int nlm_unlock_files(struct nlm_file *file)
180180
{
181181
struct file_lock lock;
182-
struct file *f;
183182

183+
locks_init_lock(&lock);
184184
lock.fl_type = F_UNLCK;
185185
lock.fl_start = 0;
186186
lock.fl_end = OFFSET_MAX;
187-
for (f = file->f_file[0]; f <= file->f_file[1]; f++) {
188-
if (f && vfs_lock_file(f, F_SETLK, &lock, NULL) < 0) {
189-
pr_warn("lockd: unlock failure in %s:%d\n",
190-
__FILE__, __LINE__);
191-
return 1;
192-
}
193-
}
187+
if (file->f_file[O_RDONLY] &&
188+
vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL))
189+
goto out_err;
190+
if (file->f_file[O_WRONLY] &&
191+
vfs_lock_file(file->f_file[O_WRONLY], F_SETLK, &lock, NULL))
192+
goto out_err;
194193
return 0;
194+
out_err:
195+
pr_warn("lockd: unlock failure in %s:%d\n", __FILE__, __LINE__);
196+
return 1;
195197
}
196198

197199
/*

fs/nfsd/nfs4state.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4130,8 +4130,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
41304130
status = nfserr_clid_inuse;
41314131
if (client_has_state(old)
41324132
&& !same_creds(&unconf->cl_cred,
4133-
&old->cl_cred))
4133+
&old->cl_cred)) {
4134+
old = NULL;
41344135
goto out;
4136+
}
41354137
status = mark_client_expired_locked(old);
41364138
if (status) {
41374139
old = NULL;

0 commit comments

Comments
 (0)