pnfs: track last_offset for layoutcommit

iozone tests were failing intermittently against emc-2 due to out-of-order LAYOUTCOMMITs that both specified new_last_offset

nfs41_open_state now maintains a cached value of the last_offset, and avoids sending it with LAYOUTCOMMIT unless the new last_offset is greater than the cached offset.  this cached value is initialized on open/delegation, and updated on setattr for size

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2011-09-02 14:57:07 -04:00 committed by unknown
parent 93a907082c
commit 6872152317
4 changed files with 50 additions and 15 deletions

View file

@ -353,10 +353,17 @@ static int handle_nfs41_set_size(setattr_upcall_args *args)
dprintf(2, "calling setattr() with size=%lld\n", info.size);
status = nfs41_setattr(state->session, &state->file, &stateid, &info);
if (status)
if (status) {
dprintf(1, "nfs41_setattr() failed with error %s.\n",
nfs_error_string(status));
goto out;
}
/* update the last offset for LAYOUTCOMMIT */
AcquireSRWLockExclusive(&state->lock);
state->pnfs_last_offset = info.size ? info.size - 1 : 0;
ReleaseSRWLockExclusive(&state->lock);
out:
return status = nfs_to_windows_error(status, ERROR_NOT_SUPPORTED);
}