]> rtime.felk.cvut.cz Git - linux-imx.git/blobdiff - fs/nfs/nfs4state.c
NFSv4: Use the open stateid if the delegation has the wrong mode
[linux-imx.git] / fs / nfs / nfs4state.c
index 1eb17285c99aef208f7954063e457d3a326758ee..b7796950eceb214e3d0d399d2bfae7379b05256c 100644 (file)
@@ -1024,12 +1024,16 @@ out:
 
 static int nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state)
 {
+       const nfs4_stateid *src;
        int ret;
        int seq;
 
        do {
+               src = &zero_stateid;
                seq = read_seqbegin(&state->seqlock);
-               nfs4_stateid_copy(dst, &state->stateid);
+               if (test_bit(NFS_OPEN_STATE, &state->flags))
+                       src = &state->open_stateid;
+               nfs4_stateid_copy(dst, src);
                ret = 0;
                smp_rmb();
                if (!list_empty(&state->owner->so_seqid.list))