Handle more response types for CB_RECALL.

- Wait for delegreturn for NFS4_OK.
- Schedule a recall for BAD_STATEID instead of directly revoking it.
  A client might have a valid file handle for the file from a open
  which did not result in a delegation grant from server.
  If the client does another open which results in granting of deleg,
  but before the client receives the response to second open, the
  server issues a recall. In this case the client will reply with
  BAD_STATID because the stateid in the recall does not represent a
  valid delegation at the cleint. The server should retry the recall
  in this case.
- Schedule a recall retry for all others.

Signed-off-by: Srikrishan Malik <srimalik@in.ibm.com>
Revoke the delegation, If schedule on deleyed_exec thread fails.

Signed-off-by: Srikrishan Malik <srimalik@in.ibm.com>
Removed unused function free_deleg_locked

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Update deleg stats before the lock entry is freed.

Signed-off-by: Srikrishan Malik <srimalik@in.ibm.com>
Update delegation stats in deleg_revoke.

Signed-off-by: Srikrishan Malik <srimalik@in.ibm.com>
Fix subtract_deleg_from_list.

Delegation locks are full length locks unlike range locks, so there
is no need to do any subtraction!  Hence renamed the function to
remove_deleg_lock. This calls remove_from_locklist to properly free
the lock.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Added base support for CLAIM_DELEGATE_PREV

Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Added nfs4_populate_revoked_delegs() to read revoked handles from
stable storage into memory.

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Corrected code under deleg_reclaim_current

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Added support for recording revoked file handles.

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Added support to check if the deleg_reclaim_prev can be granted.

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Simple name/debug changes

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Filter out FSAL_O_RECLAIM from openflags.

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Fix deleg_revoke bug

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Select filename in open4_open_owner according to the claim.

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Fix a SEGFAULT due to a NULL point deref. Also fix nfs4_write and
nfs4_read to handle delegation state correctly

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Revoked file handles needs to be cleaned up with the clientid is removed
and also we need to move these handles along with clientids in the recovery
to backup/old clientids on the stable storage.

Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Fix nfs4_read_recov_clids() looping with dot or dotdot entries

The code doesn't go to the next entry. It just processes the same entry
in an infinite loop. Changed the code to use "for" loop and removed
direct calls advancing to the next entry.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>