FreeBSD Bugzilla – Attachment 230091 Details for
Bug 260343
NFS client does not respect RLIMIT_FSIZE
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
add rlimit filesize check to nfs_allocate
rlimit.patch (text/plain), 1.30 KB, created by
Rick Macklem
on 2021-12-13 22:10:45 UTC
(
hide
)
Description:
add rlimit filesize check to nfs_allocate
Filename:
MIME Type:
Creator:
Rick Macklem
Created:
2021-12-13 22:10:45 UTC
Size:
1.30 KB
patch
obsolete
>--- sys/fs/nfsclient/nfs_clvnops.c.orig 2021-12-08 14:20:08.750672000 -0800 >+++ sys/fs/nfsclient/nfs_clvnops.c 2021-12-12 19:39:29.090632000 -0800 >@@ -3761,6 +3761,7 @@ nfs_allocate(struct vop_allocate_args *ap) > off_t alen; > int attrflag, error, ret; > struct timespec ts; >+ struct uio io; > > attrflag = 0; > nmp = VFSTONFS(vp->v_mount); >@@ -3769,18 +3770,24 @@ nfs_allocate(struct vop_allocate_args *ap) > if (NFSHASNFSV4(nmp) && nmp->nm_minorvers >= NFSV42_MINORVERSION && > (nmp->nm_privflag & NFSMNTP_NOALLOCATE) == 0) { > mtx_unlock(&nmp->nm_mtx); >+ alen = *ap->a_len; >+ if ((uint64_t)alen > nfs_maxalloclen) >+ alen = nfs_maxalloclen; >+ >+ /* Check the file size limit. */ >+ io.uio_offset = *ap->a_offset; >+ io.uio_resid = alen; >+ error = vn_rlimit_fsize(vp, &io, td); >+ > /* > * Flush first to ensure that the allocate adds to the > * file's allocation on the server. > */ >- error = ncl_flush(vp, MNT_WAIT, td, 1, 0); >- if (error == 0) { >- alen = *ap->a_len; >- if ((uint64_t)alen > nfs_maxalloclen) >- alen = nfs_maxalloclen; >+ if (error == 0) >+ error = ncl_flush(vp, MNT_WAIT, td, 1, 0); >+ if (error == 0) > error = nfsrpc_allocate(vp, *ap->a_offset, alen, > &nfsva, &attrflag, ap->a_cred, td, NULL); >- } > if (error == 0) { > *ap->a_offset += alen; > *ap->a_len -= alen;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 260343
: 230091