Skip to content

Commit c659336

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: don't kill nfsd_files because of lease break error
An error from break_lease is non-fatal, so we needn't destroy the nfsd_file in that case. Just put the reference like we normally would and return the error. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent d69b8db commit c659336

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

fs/nfsd/filecache.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
11021102
nf = nfsd_file_alloc(&key, may_flags);
11031103
if (!nf) {
11041104
status = nfserr_jukebox;
1105-
goto out_status;
1105+
goto out;
11061106
}
11071107

11081108
ret = rhashtable_lookup_insert_key(&nfsd_file_rhash_tbl,
@@ -1111,13 +1111,11 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
11111111
if (likely(ret == 0))
11121112
goto open_file;
11131113

1114-
nfsd_file_slab_free(&nf->nf_rcu);
1115-
nf = NULL;
11161114
if (ret == -EEXIST)
11171115
goto retry;
11181116
trace_nfsd_file_insert_err(rqstp, key.inode, may_flags, ret);
11191117
status = nfserr_jukebox;
1120-
goto out_status;
1118+
goto construction_err;
11211119

11221120
wait_for_construction:
11231121
wait_on_bit(&nf->nf_flags, NFSD_FILE_PENDING, TASK_UNINTERRUPTIBLE);
@@ -1127,29 +1125,25 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
11271125
trace_nfsd_file_cons_err(rqstp, key.inode, may_flags, nf);
11281126
if (!open_retry) {
11291127
status = nfserr_jukebox;
1130-
goto out;
1128+
goto construction_err;
11311129
}
11321130
open_retry = false;
1133-
if (refcount_dec_and_test(&nf->nf_ref))
1134-
nfsd_file_free(nf);
11351131
goto retry;
11361132
}
1137-
11381133
this_cpu_inc(nfsd_file_cache_hits);
11391134

11401135
status = nfserrno(nfsd_open_break_lease(file_inode(nf->nf_file), may_flags));
1136+
if (status != nfs_ok) {
1137+
nfsd_file_put(nf);
1138+
nf = NULL;
1139+
}
1140+
11411141
out:
11421142
if (status == nfs_ok) {
11431143
this_cpu_inc(nfsd_file_acquisitions);
11441144
nfsd_file_check_write_error(nf);
11451145
*pnf = nf;
1146-
} else {
1147-
if (refcount_dec_and_test(&nf->nf_ref))
1148-
nfsd_file_free(nf);
1149-
nf = NULL;
11501146
}
1151-
1152-
out_status:
11531147
put_cred(key.cred);
11541148
trace_nfsd_file_acquire(rqstp, key.inode, may_flags, nf, status);
11551149
return status;
@@ -1179,6 +1173,13 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
11791173
if (status != nfs_ok)
11801174
nfsd_file_unhash(nf);
11811175
clear_and_wake_up_bit(NFSD_FILE_PENDING, &nf->nf_flags);
1176+
if (status == nfs_ok)
1177+
goto out;
1178+
1179+
construction_err:
1180+
if (refcount_dec_and_test(&nf->nf_ref))
1181+
nfsd_file_free(nf);
1182+
nf = NULL;
11821183
goto out;
11831184
}
11841185

0 commit comments

Comments
 (0)