summaryrefslogtreecommitdiffstats
path: root/sys/fs/smbfs
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2010-05-05 16:44:25 +0000
committertrasz <trasz@FreeBSD.org>2010-05-05 16:44:25 +0000
commit402e3baadee30786a2a2fa508b9b7bec572da072 (patch)
treea3e31897fa4432edd5136dad2f999d5ce286bc3c /sys/fs/smbfs
parenta3da7d7e6937462db7db7ba830332b719a5a46fa (diff)
downloadFreeBSD-src-402e3baadee30786a2a2fa508b9b7bec572da072.zip
FreeBSD-src-402e3baadee30786a2a2fa508b9b7bec572da072.tar.gz
Move checking against RLIMIT_FSIZE into one place, vn_rlimit_fsize().
Reviewed by: kib
Diffstat (limited to 'sys/fs/smbfs')
-rw-r--r--sys/fs/smbfs/smbfs_io.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c
index 6537ed4..7e021c1 100644
--- a/sys/fs/smbfs/smbfs_io.c
+++ b/sys/fs/smbfs/smbfs_io.c
@@ -28,9 +28,7 @@
*/
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/resourcevar.h> /* defines plimit structure in proc struct */
#include <sys/kernel.h>
-#include <sys/proc.h>
#include <sys/fcntl.h>
#include <sys/bio.h>
#include <sys/buf.h>
@@ -235,7 +233,6 @@ smbfs_writevnode(struct vnode *vp, struct uio *uiop,
struct smbmount *smp = VTOSMBFS(vp);
struct smbnode *np = VTOSMB(vp);
struct smb_cred scred;
- struct proc *p;
struct thread *td;
int error = 0;
@@ -249,7 +246,6 @@ smbfs_writevnode(struct vnode *vp, struct uio *uiop,
/* if (uiop->uio_offset + uiop->uio_resid > smp->nm_maxfilesize)
return (EFBIG);*/
td = uiop->uio_td;
- p = td->td_proc;
if (ioflag & (IO_APPEND | IO_SYNC)) {
if (np->n_flag & NMODIFIED) {
smbfs_attr_cacheremove(vp);
@@ -271,16 +267,10 @@ smbfs_writevnode(struct vnode *vp, struct uio *uiop,
}
if (uiop->uio_resid == 0)
return 0;
- if (p != NULL) {
- PROC_LOCK(p);
- if (uiop->uio_offset + uiop->uio_resid >
- lim_cur(p, RLIMIT_FSIZE)) {
- psignal(p, SIGXFSZ);
- PROC_UNLOCK(p);
- return EFBIG;
- }
- PROC_UNLOCK(p);
- }
+
+ if (vn_rlimit_fsize(vp, uiop, td))
+ return (EFBIG);
+
smb_makescred(&scred, td, cred);
error = smb_write(smp->sm_share, np->n_fid, uiop, &scred);
SMBVDEBUG("after: ofs=%d,resid=%d\n",(int)uiop->uio_offset, uiop->uio_resid);
OpenPOWER on IntegriCloud