]> err.no Git - linux-2.6/blobdiff - fs/lockd/svcsubs.c
Merge branch 'upstream-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/linvil...
[linux-2.6] / fs / lockd / svcsubs.c
index bb13a48210f580b4b9d9c94382e6fdec75e9b330..e83024e16042b57c9c13fc8d64f15573b7168416 100644 (file)
@@ -78,14 +78,14 @@ static inline unsigned int file_hash(struct nfs_fh *f)
  * This is not quite right, but for now, we assume the client performs
  * the proper R/W checking.
  */
-u32
+__be32
 nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
                                        struct nfs_fh *f)
 {
        struct hlist_node *pos;
        struct nlm_file *file;
        unsigned int    hash;
-       u32             nfserr;
+       __be32          nfserr;
 
        nlm_debug_print_fh("nlm_file_lookup", f);
 
@@ -106,7 +106,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
                goto out_unlock;
 
        memcpy(&file->f_handle, f, sizeof(struct nfs_fh));
-       init_MUTEX(&file->f_sema);
+       mutex_init(&file->f_mutex);
        INIT_HLIST_NODE(&file->f_list);
        INIT_LIST_HEAD(&file->f_blocks);
 
@@ -135,12 +135,6 @@ out_unlock:
 
 out_free:
        kfree(file);
-#ifdef CONFIG_LOCKD_V4
-       if (nfserr == 1)
-               nfserr = nlm4_stale_fh;
-       else
-#endif
-       nfserr = nlm_lck_denied;
        goto out_unlock;
 }
 
@@ -324,7 +318,16 @@ nlmsvc_same_host(struct nlm_host *host, struct nlm_host *other)
 static int
 nlmsvc_is_client(struct nlm_host *host, struct nlm_host *dummy)
 {
-       return host->h_server;
+       if (host->h_server) {
+               /* we are destroying locks even though the client
+                * hasn't asked us too, so don't unmonitor the
+                * client
+                */
+               if (host->h_nsmhandle)
+                       host->h_nsmhandle->sm_sticky = 1;
+               return 1;
+       } else
+               return 0;
 }
 
 /*
@@ -354,13 +357,11 @@ nlmsvc_free_host_resources(struct nlm_host *host)
 }
 
 /*
- * delete all hosts structs for clients
+ * Remove all locks held for clients
  */
 void
 nlmsvc_invalidate_all(void)
 {
-       struct nlm_host *host;
-
        /* Release all locks held by NFS clients.
         * Previously, the code would call
         * nlmsvc_free_host_resources for each client in
@@ -368,10 +369,4 @@ nlmsvc_invalidate_all(void)
         * Now we just do it once in nlm_traverse_files.
         */
        nlm_traverse_files(NULL, nlmsvc_is_client);
-
-       while ((host = nlm_find_client()) != NULL) {
-               host->h_expires = 0;
-               host->h_killed = 1;
-               nlm_release_host(host);
-       }
 }