pNFS: Use the standard I/O stateid when calling LAYOUTGET

Instead of having a private method for copying the open/delegation stateid,
use the same call that is used for standard I/O through the MDS.

Note that this means we transmit the stateid with a zero seqid, avoiding
issues with NFS4ERR_OLD_STATEID.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>

+9 -5
+9 -5
fs/nfs/pnfs.c
··· 1664 1664 .offset = pos, 1665 1665 .length = count, 1666 1666 }; 1667 - unsigned pg_offset, seq; 1667 + unsigned pg_offset; 1668 1668 struct nfs_server *server = NFS_SERVER(ino); 1669 1669 struct nfs_client *clp = server->nfs_client; 1670 1670 struct pnfs_layout_hdr *lo = NULL; ··· 1754 1754 } 1755 1755 1756 1756 first = true; 1757 - do { 1758 - seq = read_seqbegin(&ctx->state->seqlock); 1759 - nfs4_stateid_copy(&stateid, &ctx->state->stateid); 1760 - } while (read_seqretry(&ctx->state->seqlock, seq)); 1757 + if (nfs4_select_rw_stateid(ctx->state, 1758 + iomode == IOMODE_RW ? FMODE_WRITE : FMODE_READ, 1759 + NULL, &stateid, NULL) != 0) { 1760 + trace_pnfs_update_layout(ino, pos, count, 1761 + iomode, lo, lseg, 1762 + PNFS_UPDATE_LAYOUT_INVALID_OPEN); 1763 + goto out_unlock; 1764 + } 1761 1765 } else { 1762 1766 nfs4_stateid_copy(&stateid, &lo->plh_stateid); 1763 1767 }