NFSv4.1/pNFS: pnfs_mark_matching_lsegs_return() should set the iomode

If pnfs_mark_matching_lsegs_return() needs to mark a layout segment for
return, then it must also set the return iomode.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
Trond Myklebust 2016-01-04 11:53:04 -05:00
parent 50f563ef5d
commit 5c97f5de2c
1 changed files with 12 additions and 4 deletions

View File

@ -1758,6 +1758,16 @@ out_forget_reply:
goto out; goto out;
} }
static void
pnfs_set_plh_return_iomode(struct pnfs_layout_hdr *lo, enum pnfs_iomode iomode)
{
if (lo->plh_return_iomode == iomode)
return;
if (lo->plh_return_iomode != 0)
iomode = IOMODE_ANY;
lo->plh_return_iomode = iomode;
}
void void
pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo, pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
struct list_head *tmp_list, struct list_head *tmp_list,
@ -1780,6 +1790,7 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
lseg->pls_range.offset, lseg->pls_range.offset,
lseg->pls_range.length); lseg->pls_range.length);
set_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags); set_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags);
pnfs_set_plh_return_iomode(lo, return_range->iomode);
mark_lseg_invalid(lseg, tmp_list); mark_lseg_invalid(lseg, tmp_list);
set_bit(NFS_LAYOUT_RETURN_BEFORE_CLOSE, set_bit(NFS_LAYOUT_RETURN_BEFORE_CLOSE,
&lo->plh_flags); &lo->plh_flags);
@ -1801,10 +1812,7 @@ void pnfs_error_mark_layout_for_return(struct inode *inode,
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
/* set failure bit so that pnfs path will be retried later */ /* set failure bit so that pnfs path will be retried later */
pnfs_layout_set_fail_bit(lo, iomode); pnfs_layout_set_fail_bit(lo, iomode);
if (lo->plh_return_iomode == 0) pnfs_set_plh_return_iomode(lo, range.iomode);
lo->plh_return_iomode = range.iomode;
else if (lo->plh_return_iomode != range.iomode)
lo->plh_return_iomode = IOMODE_ANY;
/* /*
* mark all matching lsegs so that we are sure to have no live * mark all matching lsegs so that we are sure to have no live
* segments at hand when sending layoutreturn. See pnfs_put_lseg() * segments at hand when sending layoutreturn. See pnfs_put_lseg()