pnfs: fix for BADLAYOUT error from LAYOUTGET
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
6269b2b112
commit
c1b603ad7f
3 changed files with 14 additions and 10 deletions
|
|
@ -1741,6 +1741,7 @@ enum nfsstat4 pnfs_rpc_layoutget(
|
||||||
IN stateid_arg *stateid,
|
IN stateid_arg *stateid,
|
||||||
IN enum pnfs_iomode iomode,
|
IN enum pnfs_iomode iomode,
|
||||||
IN uint64_t offset,
|
IN uint64_t offset,
|
||||||
|
IN uint64_t minlength,
|
||||||
IN uint64_t length,
|
IN uint64_t length,
|
||||||
OUT pnfs_layoutget_res_ok *layoutget_res_ok)
|
OUT pnfs_layoutget_res_ok *layoutget_res_ok)
|
||||||
{
|
{
|
||||||
|
|
@ -1773,7 +1774,8 @@ enum nfsstat4 pnfs_rpc_layoutget(
|
||||||
layoutget_args.layout_type = PNFS_LAYOUTTYPE_FILE;
|
layoutget_args.layout_type = PNFS_LAYOUTTYPE_FILE;
|
||||||
layoutget_args.iomode = iomode;
|
layoutget_args.iomode = iomode;
|
||||||
layoutget_args.offset = offset;
|
layoutget_args.offset = offset;
|
||||||
layoutget_args.minlength = layoutget_args.length = length;
|
layoutget_args.minlength = minlength;
|
||||||
|
layoutget_args.length = length;
|
||||||
layoutget_args.stateid = stateid;
|
layoutget_args.stateid = stateid;
|
||||||
layoutget_args.maxcount = session->fore_chan_attrs.ca_maxresponsesize - READ_OVERHEAD;
|
layoutget_args.maxcount = session->fore_chan_attrs.ca_maxresponsesize - READ_OVERHEAD;
|
||||||
ZeroMemory(&layoutget_res, sizeof(layoutget_res));
|
ZeroMemory(&layoutget_res, sizeof(layoutget_res));
|
||||||
|
|
|
||||||
|
|
@ -1151,6 +1151,7 @@ enum nfsstat4 pnfs_rpc_layoutget(
|
||||||
IN stateid_arg *stateid,
|
IN stateid_arg *stateid,
|
||||||
IN enum pnfs_iomode iomode,
|
IN enum pnfs_iomode iomode,
|
||||||
IN uint64_t offset,
|
IN uint64_t offset,
|
||||||
|
IN uint64_t minlength,
|
||||||
IN uint64_t length,
|
IN uint64_t length,
|
||||||
OUT pnfs_layoutget_res_ok *layoutget_res);
|
OUT pnfs_layoutget_res_ok *layoutget_res);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,6 +286,7 @@ static enum pnfs_status file_layout_fetch(
|
||||||
IN stateid_arg *stateid,
|
IN stateid_arg *stateid,
|
||||||
IN enum pnfs_iomode iomode,
|
IN enum pnfs_iomode iomode,
|
||||||
IN uint64_t offset,
|
IN uint64_t offset,
|
||||||
|
IN uint64_t minlength,
|
||||||
IN uint64_t length)
|
IN uint64_t length)
|
||||||
{
|
{
|
||||||
pnfs_layoutget_res_ok layoutget_res = { 0 };
|
pnfs_layoutget_res_ok layoutget_res = { 0 };
|
||||||
|
|
@ -299,8 +300,8 @@ static enum pnfs_status file_layout_fetch(
|
||||||
|
|
||||||
/* drop the lock during the rpc call */
|
/* drop the lock during the rpc call */
|
||||||
ReleaseSRWLockExclusive(&state->lock);
|
ReleaseSRWLockExclusive(&state->lock);
|
||||||
nfsstat = pnfs_rpc_layoutget(session, meta_file,
|
nfsstat = pnfs_rpc_layoutget(session, meta_file, stateid,
|
||||||
stateid, iomode, offset, length, &layoutget_res);
|
iomode, offset, minlength, length, &layoutget_res);
|
||||||
AcquireSRWLockExclusive(&state->lock);
|
AcquireSRWLockExclusive(&state->lock);
|
||||||
|
|
||||||
if (nfsstat) {
|
if (nfsstat) {
|
||||||
|
|
@ -395,14 +396,14 @@ static enum pnfs_status file_layout_cache(
|
||||||
|
|
||||||
if ((state->status & PNFS_LAYOUT_NOT_RW) == 0) {
|
if ((state->status & PNFS_LAYOUT_NOT_RW) == 0) {
|
||||||
/* try to get a RW layout first */
|
/* try to get a RW layout first */
|
||||||
status = file_layout_fetch(state, session,
|
status = file_layout_fetch(state, session, meta_file,
|
||||||
meta_file, stateid, PNFS_IOMODE_RW, offset, length);
|
stateid, PNFS_IOMODE_RW, offset, 0, NFS4_UINT32_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status && iomode == PNFS_IOMODE_READ) {
|
if (status && iomode == PNFS_IOMODE_READ) {
|
||||||
/* fall back on READ if necessary */
|
/* fall back on READ if necessary */
|
||||||
status = file_layout_fetch(state, session,
|
status = file_layout_fetch(state, session, meta_file,
|
||||||
meta_file, stateid, iomode, offset, length);
|
stateid, iomode, offset, 0, NFS4_UINT32_MAX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -517,9 +518,9 @@ static enum pnfs_status file_layout_get(
|
||||||
{
|
{
|
||||||
enum pnfs_status status;
|
enum pnfs_status status;
|
||||||
|
|
||||||
/* request a range for the entire file */
|
/* request a range that covers this io */
|
||||||
status = file_layout_cache(state, session, meta_file,
|
status = file_layout_cache(state, session,
|
||||||
stateid, iomode, 0, NFS4_UINT64_MAX);
|
meta_file, stateid, iomode, offset, length);
|
||||||
if (status) {
|
if (status) {
|
||||||
dprintf(FLLVL, "file_layout_cache() failed with %s\n",
|
dprintf(FLLVL, "file_layout_cache() failed with %s\n",
|
||||||
pnfs_error_string(status));
|
pnfs_error_string(status));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue