Remove the nm_mtx mutex locking from the test for

nm_maxfilesize. This value rarely, if ever, changes
and the nm_mtx mutex is locked/unlocked earlier in
the function, which should be sufficient to avoid
getting a stale cached value for it. There is a
discussion w.r.t. what these tests should be, but
I've left them basically the same as the regular
NFS client for now.

Suggested by:	pjd
MFC after:	2 weeks
This commit is contained in:
Rick Macklem 2011-04-21 19:56:06 +00:00
parent d95c6beaac
commit 24e2bcc006

View File

@ -946,12 +946,8 @@ ncl_write(struct vop_write_args *ap)
if (uio->uio_offset < 0)
return (EINVAL);
tmp_off = uio->uio_offset + uio->uio_resid;
mtx_lock(&nmp->nm_mtx);
if (tmp_off > nmp->nm_maxfilesize || tmp_off < uio->uio_offset) {
mtx_unlock(&nmp->nm_mtx);
if (tmp_off > nmp->nm_maxfilesize || tmp_off < uio->uio_offset)
return (EFBIG);
}
mtx_unlock(&nmp->nm_mtx);
if (uio->uio_resid == 0)
return (0);