pnfs: prepare layout under a single lock
when starting io, both pnfs_read() and pnfs_write() need a guarantee that their range is covered by layout segments. because we have to drop the lock for LAYOUTGET and GETDEVICEINFO, earlier layout segments may be recalled during this process. to avoid this, new function pnfs_layout_state_prepare() gets called repeatedly until it can verify under a single lock that 1) the entire desired range is covered with layouts and 2) each of these layouts has an associated device. whenever pnfs_layout_state_prepare() has to drop its lock for LAYOUTGET or GETDEVICEINFO, it returns PNFS_PENDING on PNFS_SUCCESS, the caller knows that all segments in the range are valid and can dispatch io to those segments without worrying about recalls, because it still holds the pnfs_layout_state lock Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
c66771cda6
commit
91609640df
4 changed files with 256 additions and 276 deletions
|
|
@ -114,8 +114,7 @@ static int read_from_pnfs(
|
|||
enum pnfs_status pnfsstat;
|
||||
int status = NO_ERROR;
|
||||
|
||||
if (pnfs_layout_state_open(upcall->state_ref, PNFS_IOMODE_READ,
|
||||
args->offset, args->len, &layout)) {
|
||||
if (pnfs_layout_state_open(upcall->state_ref, &layout)) {
|
||||
status = ERROR_NOT_SUPPORTED;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -250,15 +249,14 @@ out_verify_failed:
|
|||
|
||||
static int write_to_pnfs(
|
||||
IN nfs41_upcall *upcall,
|
||||
IN const stateid_arg *stateid)
|
||||
IN stateid_arg *stateid)
|
||||
{
|
||||
readwrite_upcall_args *args = &upcall->args.rw;
|
||||
pnfs_layout_state *layout;
|
||||
int status = NO_ERROR;
|
||||
nfs41_file_info info = { 0 };
|
||||
|
||||
if (pnfs_layout_state_open(upcall->state_ref, PNFS_IOMODE_RW, args->offset,
|
||||
args->len, &layout)) {
|
||||
if (pnfs_layout_state_open(upcall->state_ref, &layout)) {
|
||||
status = ERROR_NOT_SUPPORTED;
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue