summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2017-09-11 13:09:37 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2017-09-11 22:19:00 -0400
commit70d2f7b1ea19b7e43e36ccc63496f45f9908134d (patch)
treee4ae5571a942caa20bbe4a9119d34944839feffb
parent1bd5d6d08ea7ed0794c8a3908383d6d6fc202cdd (diff)
downloadlinux-rpi3-70d2f7b1ea19b7e43e36ccc63496f45f9908134d.tar.gz
linux-rpi3-70d2f7b1ea19b7e43e36ccc63496f45f9908134d.tar.bz2
linux-rpi3-70d2f7b1ea19b7e43e36ccc63496f45f9908134d.zip
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>
-rw-r--r--fs/nfs/pnfs.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 7879ed8ceb76..3bcd669a3152 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1664,7 +1664,7 @@ pnfs_update_layout(struct inode *ino,
.offset = pos,
.length = count,
};
- unsigned pg_offset, seq;
+ unsigned pg_offset;
struct nfs_server *server = NFS_SERVER(ino);
struct nfs_client *clp = server->nfs_client;
struct pnfs_layout_hdr *lo = NULL;
@@ -1754,10 +1754,14 @@ lookup_again:
}
first = true;
- do {
- seq = read_seqbegin(&ctx->state->seqlock);
- nfs4_stateid_copy(&stateid, &ctx->state->stateid);
- } while (read_seqretry(&ctx->state->seqlock, seq));
+ if (nfs4_select_rw_stateid(ctx->state,
+ iomode == IOMODE_RW ? FMODE_WRITE : FMODE_READ,
+ NULL, &stateid, NULL) != 0) {
+ trace_pnfs_update_layout(ino, pos, count,
+ iomode, lo, lseg,
+ PNFS_UPDATE_LAYOUT_INVALID_OPEN);
+ goto out_unlock;
+ }
} else {
nfs4_stateid_copy(&stateid, &lo->plh_stateid);
}