nfs: change nfs4_do_setlk params to identify recovery type
authorAlexandros Batsakis <batsakis@netapp.com>
Wed, 9 Dec 2009 09:50:14 +0000 (01:50 -0800)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 15 Dec 2009 18:50:32 +0000 (13:50 -0500)
Signed-off-by: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4_fs.h
fs/nfs/nfs4proc.c

index 7e57b04e40141f5971dfabd63f848d07cc7ceeb2..e8791d5a2f7a1f84034b49354d9f666d80bafee4 100644 (file)
@@ -108,6 +108,10 @@ enum {
        NFS_OWNER_RECLAIM_NOGRACE
 };
 
+#define NFS_LOCK_NEW           0
+#define NFS_LOCK_RECLAIM       1
+#define NFS_LOCK_EXPIRED       2
+
 /*
  * struct nfs4_state maintains the client-side state for a given
  * (state_owner,inode) tuple (OPEN) or state_owner (LOCK).
index 297e23310efd4fc506eb3d7abd4c624293708b3c..d44f1071930f21c3d98b6d54bf03aad14ceee19e 100644 (file)
@@ -4002,7 +4002,7 @@ static const struct rpc_call_ops nfs4_lock_ops = {
        .rpc_release = nfs4_lock_release,
 };
 
-static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *fl, int reclaim)
+static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *fl, int recovery_type)
 {
        struct nfs4_lockdata *data;
        struct rpc_task *task;
@@ -4026,8 +4026,8 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
                return -ENOMEM;
        if (IS_SETLKW(cmd))
                data->arg.block = 1;
-       if (reclaim != 0)
-               data->arg.reclaim = 1;
+       if (recovery_type == NFS_LOCK_RECLAIM)
+                       data->arg.reclaim = NFS_LOCK_RECLAIM;
        msg.rpc_argp = &data->arg,
        msg.rpc_resp = &data->res,
        task_setup_data.callback_data = data;
@@ -4054,7 +4054,7 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request
                /* Cache the lock if possible... */
                if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0)
                        return 0;
-               err = _nfs4_do_setlk(state, F_SETLK, request, 1);
+               err = _nfs4_do_setlk(state, F_SETLK, request, NFS_LOCK_RECLAIM);
                if (err != -NFS4ERR_DELAY)
                        break;
                nfs4_handle_exception(server, err, &exception);
@@ -4074,7 +4074,7 @@ static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request
        do {
                if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0)
                        return 0;
-               err = _nfs4_do_setlk(state, F_SETLK, request, 0);
+               err = _nfs4_do_setlk(state, F_SETLK, request, NFS_LOCK_EXPIRED);
                switch (err) {
                default:
                        goto out;
@@ -4110,7 +4110,7 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock
                status = do_vfs_lock(request->fl_file, request);
                goto out_unlock;
        }
-       status = _nfs4_do_setlk(state, cmd, request, 0);
+       status = _nfs4_do_setlk(state, cmd, request, NFS_LOCK_NEW);
        if (status != 0)
                goto out_unlock;
        /* Note: we always want to sleep here! */
@@ -4193,7 +4193,7 @@ int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl)
        if (err != 0)
                goto out;
        do {
-               err = _nfs4_do_setlk(state, F_SETLK, fl, 0);
+               err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW);
                switch (err) {
                        default:
                                printk(KERN_ERR "%s: unhandled error %d.\n",