Skip to content

Commit 70d2f7b

Browse files
committed
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>
1 parent 1bd5d6d commit 70d2f7b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

fs/nfs/pnfs.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ pnfs_update_layout(struct inode *ino,
16641664
.offset = pos,
16651665
.length = count,
16661666
};
1667-
unsigned pg_offset, seq;
1667+
unsigned pg_offset;
16681668
struct nfs_server *server = NFS_SERVER(ino);
16691669
struct nfs_client *clp = server->nfs_client;
16701670
struct pnfs_layout_hdr *lo = NULL;
@@ -1754,10 +1754,14 @@ pnfs_update_layout(struct inode *ino,
17541754
}
17551755

17561756
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+
}
17611765
} else {
17621766
nfs4_stateid_copy(&stateid, &lo->plh_stateid);
17631767
}

0 commit comments

Comments
 (0)