In NFSv4.1, stateid checks are skipped for all special stateid operations.
This patch fixes the close failure with BAD_STATEID error.
This patch is based on https://github.com/nfs-ganesha/nfs-ganesha/tree/next
and has been tested. Please review the changes.

commit 6bb4a3369965745535ad197a4aadf10dd8897952
Author: Bharat Singh <[email protected]>
Date:   Tue Nov 24 20:39:30 2015 -0500

    Fix close failure with BAD_STATEID error

    close will fail with NFS4ERR_BAD_STATEID when used with special
stateids.
    Server should ignore stateid checks and should not modify the transient
    states.

    Signed-off-by: Bharat Singh <[email protected]>

diff --git a/src/Protocols/NFS/nfs4_op_close.c
b/src/Protocols/NFS/nfs4_op_close.c
index 3fd6028..9474ba7 100644
--- a/src/Protocols/NFS/nfs4_op_close.c
+++ b/src/Protocols/NFS/nfs4_op_close.c
@@ -172,7 +172,7 @@ int nfs4_op_close(struct nfs_argop4 *op,
compound_data_t *data,
  data,
  data->minorversion == 0 ?
     STATEID_SPECIAL_FOR_CLOSE_40 :
-    STATEID_SPECIAL_FOR_CLOSE_41,
+    STATEID_SPECIAL_FOR_CLOSE_41 | STATEID_SPECIAL_CURRENT,
  arg_CLOSE4->seqid,
  data->minorversion == 0,
  close_tag);
diff --git a/src/SAL/nfs4_state_id.c b/src/SAL/nfs4_state_id.c
index 41d2cb8..0290ef7 100644
--- a/src/SAL/nfs4_state_id.c
+++ b/src/SAL/nfs4_state_id.c
@@ -545,7 +545,7 @@ nfsstat4 nfs4_Check_Stateid(stateid4 *stateid,
cache_entry_t *entry,
  /** @todo FSF: eventually this may want to return an
  * actual state for use in temporary locks for I/O.
  */
- data->current_stateid_valid = false;
+ /* special stateid operation should not touch transient state */
  goto success;
  }
  if (stateid->seqid == 1
@@ -587,7 +587,7 @@ nfsstat4 nfs4_Check_Stateid(stateid4 *stateid,
cache_entry_t *entry,
  /** @todo FSF: eventually this may want to return an
  * actual state for use in temporary locks for I/O.
  */
- data->current_stateid_valid = false;
+ /* special stateid operation should not touch transient state */
  goto success;
  }

Attachment: commit-6bb4a33
Description: Binary data

------------------------------------------------------------------------------
_______________________________________________
Nfs-ganesha-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel

Reply via email to