diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2013-06-21 22:46:16 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2013-06-21 22:46:16 +0000 |
commit | 121288ceb2ac8d76c29b049399d81116e370bd63 (patch) | |
tree | 44b40af85584710bc95b580121ce783a687daef5 /sys/fs | |
parent | b3e84941b0d829d5e6cba05791c20e155ae80365 (diff) | |
download | FreeBSD-src-121288ceb2ac8d76c29b049399d81116e370bd63.zip FreeBSD-src-121288ceb2ac8d76c29b049399d81116e370bd63.tar.gz |
The NFSv4.1 LayoutCommit operation requires a valid offset and length.
(0, 0 is not sufficient) This patch a loop for each file layout, using
the offset, length of each file layout in a separate LayoutCommit.
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/nfsclient/nfs_clstate.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index c62000c..4ad885d 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -5145,16 +5145,28 @@ static void nfscl_dolayoutcommit(struct nfsmount *nmp, struct nfscllayout *lyp, struct ucred *cred, NFSPROC_T *p) { + struct nfsclflayout *flp; + uint64_t len; int error; - error = nfsrpc_layoutcommit(nmp, lyp->nfsly_fh, lyp->nfsly_fhlen, - 0, 0, 0, lyp->nfsly_lastbyte, &lyp->nfsly_stateid, - NFSLAYOUT_NFSV4_1_FILES, 0, NULL, cred, p, NULL); - if (error == NFSERR_NOTSUPP) { - /* If the server doesn't want it, don't bother doing it. */ - NFSLOCKMNT(nmp); - nmp->nm_state |= NFSSTA_NOLAYOUTCOMMIT; - NFSUNLOCKMNT(nmp); + LIST_FOREACH(flp, &lyp->nfsly_flayrw, nfsfl_list) { + if (flp->nfsfl_off <= lyp->nfsly_lastbyte) { + len = flp->nfsfl_end - flp->nfsfl_off; + error = nfsrpc_layoutcommit(nmp, lyp->nfsly_fh, + lyp->nfsly_fhlen, 0, flp->nfsfl_off, len, + lyp->nfsly_lastbyte, &lyp->nfsly_stateid, + NFSLAYOUT_NFSV4_1_FILES, 0, NULL, cred, p, NULL); + NFSCL_DEBUG(4, "layoutcommit err=%d off=%qd len=%qd " + "lastbyte=%qd\n", error, flp->nfsfl_off, len, + lyp->nfsly_lastbyte); + if (error == NFSERR_NOTSUPP) { + /* If not supported, don't bother doing it. */ + NFSLOCKMNT(nmp); + nmp->nm_state |= NFSSTA_NOLAYOUTCOMMIT; + NFSUNLOCKMNT(nmp); + break; + } + } } } |