upgrade to fedora-2.6.12-1.1398.FC4 + vserver 2.0.rc7
[linux-2.6.git] / fs / lockd / clntproc.c
index 57b1e77..d7dbc65 100644 (file)
@@ -312,6 +312,7 @@ static int nlm_wait_on_grace(wait_queue_head_t *queue)
        prepare_to_wait(queue, &wait, TASK_INTERRUPTIBLE);
        if (!signalled ()) {
                schedule_timeout(NLMCLNT_GRACE_WAIT);
+               try_to_freeze(PF_FREEZE);
                if (!signalled ())
                        status = 0;
        }
@@ -322,7 +323,7 @@ static int nlm_wait_on_grace(wait_queue_head_t *queue)
 /*
  * Generic NLM call
  */
-int
+static int
 nlmclnt_call(struct nlm_rqst *req, u32 proc)
 {
        struct nlm_host *host = req->a_host;
@@ -424,7 +425,7 @@ nlmsvc_async_call(struct nlm_rqst *req, u32 proc, rpc_action callback)
        return status;
 }
 
-int
+static int
 nlmclnt_async_call(struct nlm_rqst *req, u32 proc, rpc_action callback)
 {
        struct nlm_host *host = req->a_host;
@@ -509,6 +510,24 @@ static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *ho
        fl->fl_ops = &nlmclnt_lock_ops;
 }
 
+static void do_vfs_lock(struct file_lock *fl)
+{
+       int res = 0;
+       switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
+               case FL_POSIX:
+                       res = posix_lock_file_wait(fl->fl_file, fl);
+                       break;
+               case FL_FLOCK:
+                       res = flock_lock_file_wait(fl->fl_file, fl);
+                       break;
+               default:
+                       BUG();
+       }
+       if (res < 0)
+               printk(KERN_WARNING "%s: VFS is out of sync with lock manager!\n",
+                               __FUNCTION__);
+}
+
 /*
  * LOCK: Try to create a lock
  *
@@ -557,9 +576,7 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
                fl->fl_u.nfs_fl.state = host->h_state;
                fl->fl_u.nfs_fl.flags |= NFS_LCK_GRANTED;
                fl->fl_flags |= FL_SLEEP;
-               if (posix_lock_file_wait(fl->fl_file, fl) < 0)
-                               printk(KERN_WARNING "%s: VFS is out of sync with lock manager!\n",
-                                               __FUNCTION__);
+               do_vfs_lock(fl);
        }
        status = nlm_stat_to_errno(resp->status);
 out:
@@ -644,7 +661,7 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
                                        nlmclnt_unlock_callback);
                /* Hrmf... Do the unlock early since locks_remove_posix()
                 * really expects us to free the lock synchronously */
-               posix_lock_file(fl->fl_file, fl);
+               do_vfs_lock(fl);
                if (status < 0) {
                        nlmclnt_release_lockargs(req);
                        kfree(req);
@@ -657,7 +674,7 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
        if (status < 0)
                return status;
 
-       posix_lock_file(fl->fl_file, fl);
+       do_vfs_lock(fl);
        if (resp->status == NLM_LCK_GRANTED)
                return 0;