diff options
Diffstat (limited to 'fs/lockd/svcsubs.c')
-rw-r--r-- | fs/lockd/svcsubs.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index 62f4a385177f..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) |
30 | static struct nlm_file * nlm_files[FILE_NRHASH]; | 31 | static struct nlm_file * nlm_files[FILE_NRHASH]; |
31 | static DECLARE_MUTEX(nlm_file_sema); | 32 | static DEFINE_MUTEX(nlm_file_mutex); |
32 | 33 | ||
33 | #ifdef NFSD_DEBUG | 34 | #ifdef NFSD_DEBUG |
34 | static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f) | 35 | static 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 | ||
132 | out_unlock: | 133 | out_unlock: |
133 | up(&nlm_file_sema); | 134 | mutex_unlock(&nlm_file_mutex); |
134 | return nfserr; | 135 | return nfserr; |
135 | 136 | ||
136 | out_free: | 137 | out_free: |
@@ -182,7 +183,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_file *file, int action) | |||
182 | again: | 183 | again: |
183 | file->f_locks = 0; | 184 | file->f_locks = 0; |
184 | for (fl = inode->i_flock; fl; fl = fl->fl_next) { | 185 | for (fl = inode->i_flock; fl; fl = fl->fl_next) { |
185 | if (!(fl->fl_flags & FL_LOCKD)) | 186 | if (fl->fl_lmops != &nlmsvc_lock_operations) |
186 | continue; | 187 | continue; |
187 | 188 | ||
188 | /* update current lock count */ | 189 | /* update current lock count */ |
@@ -224,9 +225,8 @@ nlm_inspect_file(struct nlm_host *host, struct nlm_file *file, int action) | |||
224 | if (file->f_count || file->f_blocks || file->f_shares) | 225 | if (file->f_count || file->f_blocks || file->f_shares) |
225 | return 1; | 226 | return 1; |
226 | } else { | 227 | } else { |
227 | if (nlmsvc_traverse_blocks(host, file, action) | 228 | nlmsvc_traverse_blocks(host, file, action); |
228 | || nlmsvc_traverse_shares(host, file, action)) | 229 | nlmsvc_traverse_shares(host, file, action); |
229 | return 1; | ||
230 | } | 230 | } |
231 | return nlm_traverse_locks(host, file, action); | 231 | return nlm_traverse_locks(host, file, action); |
232 | } | 232 | } |
@@ -240,14 +240,14 @@ nlm_traverse_files(struct nlm_host *host, int action) | |||
240 | struct nlm_file *file, **fp; | 240 | struct nlm_file *file, **fp; |
241 | int i; | 241 | int i; |
242 | 242 | ||
243 | down(&nlm_file_sema); | 243 | mutex_lock(&nlm_file_mutex); |
244 | for (i = 0; i < FILE_NRHASH; i++) { | 244 | for (i = 0; i < FILE_NRHASH; i++) { |
245 | fp = nlm_files + i; | 245 | fp = nlm_files + i; |
246 | while ((file = *fp) != NULL) { | 246 | while ((file = *fp) != NULL) { |
247 | /* Traverse locks, blocks and shares of this file | 247 | /* Traverse locks, blocks and shares of this file |
248 | * and update file->f_locks count */ | 248 | * and update file->f_locks count */ |
249 | if (nlm_inspect_file(host, file, action)) { | 249 | if (nlm_inspect_file(host, file, action)) { |
250 | up(&nlm_file_sema); | 250 | mutex_unlock(&nlm_file_mutex); |
251 | return 1; | 251 | return 1; |
252 | } | 252 | } |
253 | 253 | ||
@@ -262,7 +262,7 @@ nlm_traverse_files(struct nlm_host *host, int action) | |||
262 | } | 262 | } |
263 | } | 263 | } |
264 | } | 264 | } |
265 | up(&nlm_file_sema); | 265 | mutex_unlock(&nlm_file_mutex); |
266 | return 0; | 266 | return 0; |
267 | } | 267 | } |
268 | 268 | ||
@@ -282,7 +282,7 @@ nlm_release_file(struct nlm_file *file) | |||
282 | file, file->f_count); | 282 | file, file->f_count); |
283 | 283 | ||
284 | /* Lock file table */ | 284 | /* Lock file table */ |
285 | down(&nlm_file_sema); | 285 | mutex_lock(&nlm_file_mutex); |
286 | 286 | ||
287 | /* If there are no more locks etc, delete the file */ | 287 | /* If there are no more locks etc, delete the file */ |
288 | if(--file->f_count == 0) { | 288 | if(--file->f_count == 0) { |
@@ -290,7 +290,7 @@ nlm_release_file(struct nlm_file *file) | |||
290 | nlm_delete_file(file); | 290 | nlm_delete_file(file); |
291 | } | 291 | } |
292 | 292 | ||
293 | up(&nlm_file_sema); | 293 | mutex_unlock(&nlm_file_mutex); |
294 | } | 294 | } |
295 | 295 | ||
296 | /* | 296 | /* |