summaryrefslogtreecommitdiffstats
path: root/sys/fs/nfsclient/nfs_clbio.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-02-21 01:05:12 +0000
committerkib <kib@FreeBSD.org>2012-02-21 01:05:12 +0000
commit80ae8fe82cdaa69f78dc90fa27bc9e79863de0ea (patch)
treed0d078391c4959fc08545db4ab619daadd9cf1d9 /sys/fs/nfsclient/nfs_clbio.c
parent31a24bc1664a822f3d06595f42063719e6902ff1 (diff)
downloadFreeBSD-src-80ae8fe82cdaa69f78dc90fa27bc9e79863de0ea.zip
FreeBSD-src-80ae8fe82cdaa69f78dc90fa27bc9e79863de0ea.tar.gz
Fix found places where uio_resid is truncated to int.
Add the sysctl debug.iosize_max_clamp, enabled by default. Setting the sysctl to zero allows to perform the SSIZE_MAX-sized i/o requests from the usermode. Discussed with: bde, das (previous versions) MFC after: 1 month
Diffstat (limited to 'sys/fs/nfsclient/nfs_clbio.c')
-rw-r--r--sys/fs/nfsclient/nfs_clbio.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c
index 82a3692..d63862e 100644
--- a/sys/fs/nfsclient/nfs_clbio.c
+++ b/sys/fs/nfsclient/nfs_clbio.c
@@ -570,7 +570,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
n = 0;
if (on < bcount)
- n = min((unsigned)(bcount - on), uio->uio_resid);
+ n = MIN((unsigned)(bcount - on), uio->uio_resid);
break;
case VLNK:
NFSINCRGLOBAL(newnfsstats.biocache_readlinks);
@@ -589,7 +589,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
return (error);
}
}
- n = min(uio->uio_resid, NFS_MAXPATHLEN - bp->b_resid);
+ n = MIN(uio->uio_resid, NFS_MAXPATHLEN - bp->b_resid);
on = 0;
break;
case VDIR:
@@ -757,8 +757,8 @@ nfs_directio_write(vp, uiop, cred, ioflag)
struct iovec iov;
do_sync:
while (uiop->uio_resid > 0) {
- size = min(uiop->uio_resid, wsize);
- size = min(uiop->uio_iov->iov_len, size);
+ size = MIN(uiop->uio_resid, wsize);
+ size = MIN(uiop->uio_iov->iov_len, size);
iov.iov_base = uiop->uio_iov->iov_base;
iov.iov_len = size;
uio.uio_iov = &iov;
@@ -806,8 +806,8 @@ do_sync:
* in NFS directio access.
*/
while (uiop->uio_resid > 0) {
- size = min(uiop->uio_resid, wsize);
- size = min(uiop->uio_iov->iov_len, size);
+ size = MIN(uiop->uio_resid, wsize);
+ size = MIN(uiop->uio_iov->iov_len, size);
bp = getpbuf(&ncl_pbuf_freecnt);
t_uio = malloc(sizeof(struct uio), M_NFSDIRECTIO, M_WAITOK);
t_iov = malloc(sizeof(struct iovec), M_NFSDIRECTIO, M_WAITOK);
@@ -1023,7 +1023,7 @@ flush_and_restart:
NFSINCRGLOBAL(newnfsstats.biocache_writes);
lbn = uio->uio_offset / biosize;
on = uio->uio_offset & (biosize-1);
- n = min((unsigned)(biosize - on), uio->uio_resid);
+ n = MIN((unsigned)(biosize - on), uio->uio_resid);
again:
/*
* Handle direct append and file extension cases, calculate
@@ -1572,7 +1572,7 @@ ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td,
* writes, but that is not possible any longer.
*/
int nread = bp->b_bcount - uiop->uio_resid;
- int left = uiop->uio_resid;
+ ssize_t left = uiop->uio_resid;
if (left > 0)
bzero((char *)bp->b_data + nread, left);
OpenPOWER on IntegriCloud