Lines 3761-3766
nfs_allocate(struct vop_allocate_args *ap)
Link Here
|
3761 |
off_t alen; |
3761 |
off_t alen; |
3762 |
int attrflag, error, ret; |
3762 |
int attrflag, error, ret; |
3763 |
struct timespec ts; |
3763 |
struct timespec ts; |
|
|
3764 |
struct uio io; |
3764 |
|
3765 |
|
3765 |
attrflag = 0; |
3766 |
attrflag = 0; |
3766 |
nmp = VFSTONFS(vp->v_mount); |
3767 |
nmp = VFSTONFS(vp->v_mount); |
Lines 3769-3786
nfs_allocate(struct vop_allocate_args *ap)
Link Here
|
3769 |
if (NFSHASNFSV4(nmp) && nmp->nm_minorvers >= NFSV42_MINORVERSION && |
3770 |
if (NFSHASNFSV4(nmp) && nmp->nm_minorvers >= NFSV42_MINORVERSION && |
3770 |
(nmp->nm_privflag & NFSMNTP_NOALLOCATE) == 0) { |
3771 |
(nmp->nm_privflag & NFSMNTP_NOALLOCATE) == 0) { |
3771 |
mtx_unlock(&nmp->nm_mtx); |
3772 |
mtx_unlock(&nmp->nm_mtx); |
|
|
3773 |
alen = *ap->a_len; |
3774 |
if ((uint64_t)alen > nfs_maxalloclen) |
3775 |
alen = nfs_maxalloclen; |
3776 |
|
3777 |
/* Check the file size limit. */ |
3778 |
io.uio_offset = *ap->a_offset; |
3779 |
io.uio_resid = alen; |
3780 |
error = vn_rlimit_fsize(vp, &io, td); |
3781 |
|
3772 |
/* |
3782 |
/* |
3773 |
* Flush first to ensure that the allocate adds to the |
3783 |
* Flush first to ensure that the allocate adds to the |
3774 |
* file's allocation on the server. |
3784 |
* file's allocation on the server. |
3775 |
*/ |
3785 |
*/ |
3776 |
error = ncl_flush(vp, MNT_WAIT, td, 1, 0); |
3786 |
if (error == 0) |
3777 |
if (error == 0) { |
3787 |
error = ncl_flush(vp, MNT_WAIT, td, 1, 0); |
3778 |
alen = *ap->a_len; |
3788 |
if (error == 0) |
3779 |
if ((uint64_t)alen > nfs_maxalloclen) |
|
|
3780 |
alen = nfs_maxalloclen; |
3781 |
error = nfsrpc_allocate(vp, *ap->a_offset, alen, |
3789 |
error = nfsrpc_allocate(vp, *ap->a_offset, alen, |
3782 |
&nfsva, &attrflag, ap->a_cred, td, NULL); |
3790 |
&nfsva, &attrflag, ap->a_cred, td, NULL); |
3783 |
} |
|
|
3784 |
if (error == 0) { |
3791 |
if (error == 0) { |
3785 |
*ap->a_offset += alen; |
3792 |
*ap->a_offset += alen; |
3786 |
*ap->a_len -= alen; |
3793 |
*ap->a_len -= alen; |