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.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index c7a6e3ae44d6..a570e5c8a930 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -11,6 +11,7 @@
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/time.h> 12#include <linux/time.h>
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/mutex.h>
14#include <linux/sunrpc/svc.h> 15#include <linux/sunrpc/svc.h>
15#include <linux/sunrpc/clnt.h> 16#include <linux/sunrpc/clnt.h>
16#include <linux/nfsd/nfsfh.h> 17#include <linux/nfsd/nfsfh.h>
@@ -28,7 +29,7 @@
28#define FILE_HASH_BITS 5 29#define FILE_HASH_BITS 5
29#define FILE_NRHASH (1<<FILE_HASH_BITS) 30#define FILE_NRHASH (1<<FILE_HASH_BITS)
30static struct nlm_file * nlm_files[FILE_NRHASH]; 31static struct nlm_file * nlm_files[FILE_NRHASH];
31static DECLARE_MUTEX(nlm_file_sema); 32static DEFINE_MUTEX(nlm_file_mutex);
32 33
33#ifdef NFSD_DEBUG 34#ifdef NFSD_DEBUG
34static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f) 35static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
@@ -91,7 +92,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
91 hash = file_hash(f); 92 hash = file_hash(f);
92 93
93 /* Lock file table */ 94 /* Lock file table */
94 down(&nlm_file_sema); 95 mutex_lock(&nlm_file_mutex);
95 96
96 for (file = nlm_files[hash]; file; file = file->f_next) 97 for (file = nlm_files[hash]; file; file = file->f_next)
97 if (!nfs_compare_fh(&file->f_handle, f)) 98 if (!nfs_compare_fh(&file->f_handle, f))
@@ -130,7 +131,7 @@ found:
130 nfserr = 0; 131 nfserr = 0;
131 132
132out_unlock: 133out_unlock:
133 up(&nlm_file_sema); 134 mutex_unlock(&nlm_file_mutex);
134 return nfserr; 135 return nfserr;
135 136
136out_free: 137out_free:
@@ -239,14 +240,14 @@ nlm_traverse_files(struct nlm_host *host, int action)
239 struct nlm_file *file, **fp; 240 struct nlm_file *file, **fp;
240 int i; 241 int i;
241 242
242 down(&nlm_file_sema); 243 mutex_lock(&nlm_file_mutex);
243 for (i = 0; i < FILE_NRHASH; i++) { 244 for (i = 0; i < FILE_NRHASH; i++) {
244 fp = nlm_files + i; 245 fp = nlm_files + i;
245 while ((file = *fp) != NULL) { 246 while ((file = *fp) != NULL) {
246 /* Traverse locks, blocks and shares of this file 247 /* Traverse locks, blocks and shares of this file
247 * and update file->f_locks count */ 248 * and update file->f_locks count */
248 if (nlm_inspect_file(host, file, action)) { 249 if (nlm_inspect_file(host, file, action)) {
249 up(&nlm_file_sema); 250 mutex_unlock(&nlm_file_mutex);
250 return 1; 251 return 1;
251 } 252 }
252 253
@@ -261,7 +262,7 @@ nlm_traverse_files(struct nlm_host *host, int action)
261 } 262 }
262 } 263 }
263 } 264 }
264 up(&nlm_file_sema); 265 mutex_unlock(&nlm_file_mutex);
265 return 0; 266 return 0;
266} 267}
267 268
@@ -281,7 +282,7 @@ nlm_release_file(struct nlm_file *file)
281 file, file->f_count); 282 file, file->f_count);
282 283
283 /* Lock file table */ 284 /* Lock file table */
284 down(&nlm_file_sema); 285 mutex_lock(&nlm_file_mutex);
285 286
286 /* If there are no more locks etc, delete the file */ 287 /* If there are no more locks etc, delete the file */
287 if(--file->f_count == 0) { 288 if(--file->f_count == 0) {
@@ -289,7 +290,7 @@ nlm_release_file(struct nlm_file *file)
289 nlm_delete_file(file); 290 nlm_delete_file(file);
290 } 291 }
291 292
292 up(&nlm_file_sema); 293 mutex_unlock(&nlm_file_mutex);
293} 294}
294 295
295/* 296/*