Mercurial > illumos > illumos-gate
changeset 3161:187c511fc2bf
6449532 NFSv3 mount of a shared CD-ROM file system fails with ESTALE
author | peteh |
---|---|
date | Thu, 23 Nov 2006 01:47:42 -0800 |
parents | 8234795d0b5f |
children | b8af42ef962d |
files | usr/src/uts/common/fs/nfs/nfs_export.c |
diffstat | 1 files changed, 26 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/fs/nfs/nfs_export.c Wed Nov 22 18:59:14 2006 -0800 +++ b/usr/src/uts/common/fs/nfs/nfs_export.c Thu Nov 23 01:47:42 2006 -0800 @@ -1657,7 +1657,7 @@ l = NFS_FHSIZE; logptr = buf; } else if (vers == NFS_V3) { - int i, sz; + int i, sz, pad; error = makefh3(&fh, vp, exi); l = fh.fh3_length; @@ -1667,18 +1667,37 @@ sz = sizeof (fsid_t); bcopy(&fh.fh3_fsid, &buf[i], sz); i += sz; + + /* + * For backwards compatability, the + * fid length may be less than + * NFS_FHMAXDATA, but it was always + * encoded as NFS_FHMAXDATA bytes. + */ + sz = sizeof (ushort_t); bcopy(&fh.fh3_len, &buf[i], sz); i += sz; - sz = fh.fh3_len; - bcopy(fh.fh3_data, &buf[i], sz); - i += sz; + bcopy(fh.fh3_data, &buf[i], fh.fh3_len); + i += fh.fh3_len; + pad = (NFS_FHMAXDATA - fh.fh3_len); + if (pad > 0) { + bzero(&buf[i], pad); + i += pad; + l += pad; + } + sz = sizeof (ushort_t); bcopy(&fh.fh3_xlen, &buf[i], sz); i += sz; - sz = fh.fh3_xlen; - bcopy(fh.fh3_xdata, &buf[i], sz); - i += sz; + bcopy(fh.fh3_xdata, &buf[i], fh.fh3_xlen); + i += fh.fh3_xlen; + pad = (NFS_FHMAXDATA - fh.fh3_xlen); + if (pad > 0) { + bzero(&buf[i], pad); + i += pad; + l += pad; + } } /* * If we need to do NFS logging, the filehandle