aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svcsubs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/lockd/svcsubs.c')
-rw-r--r--fs/lockd/svcsubs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index c8308bccd319..a92fc5813144 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -107,6 +107,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
107 memcpy(&file->f_handle, f, sizeof(struct nfs_fh)); 107 memcpy(&file->f_handle, f, sizeof(struct nfs_fh));
108 file->f_hash = hash; 108 file->f_hash = hash;
109 init_MUTEX(&file->f_sema); 109 init_MUTEX(&file->f_sema);
110 INIT_LIST_HEAD(&file->f_blocks);
110 111
111 /* Open the file. Note that this must not sleep for too long, else 112 /* Open the file. Note that this must not sleep for too long, else
112 * we would lock up lockd:-) So no NFS re-exports, folks. 113 * we would lock up lockd:-) So no NFS re-exports, folks.
@@ -220,7 +221,7 @@ nlm_inspect_file(struct nlm_host *host, struct nlm_file *file, int action)
220{ 221{
221 if (action == NLM_ACT_CHECK) { 222 if (action == NLM_ACT_CHECK) {
222 /* Fast path for mark and sweep garbage collection */ 223 /* Fast path for mark and sweep garbage collection */
223 if (file->f_count || file->f_blocks || file->f_shares) 224 if (file->f_count || list_empty(&file->f_blocks) || file->f_shares)
224 return 1; 225 return 1;
225 } else { 226 } else {
226 nlmsvc_traverse_blocks(host, file, action); 227 nlmsvc_traverse_blocks(host, file, action);
@@ -253,7 +254,7 @@ nlm_traverse_files(struct nlm_host *host, int action)
253 mutex_lock(&nlm_file_mutex); 254 mutex_lock(&nlm_file_mutex);
254 file->f_count--; 255 file->f_count--;
255 /* No more references to this file. Let go of it. */ 256 /* No more references to this file. Let go of it. */
256 if (!file->f_blocks && !file->f_locks 257 if (list_empty(&file->f_blocks) && !file->f_locks
257 && !file->f_shares && !file->f_count) { 258 && !file->f_shares && !file->f_count) {
258 *fp = file->f_next; 259 *fp = file->f_next;
259 nlmsvc_ops->fclose(file->f_file); 260 nlmsvc_ops->fclose(file->f_file);