Re: [NFS] Updated patch for the [2.4.x] NFS 'missing directory entry a.k.a. IRIX server' problem...

H . J . Lu (hjl@valinux.com)
Tue, 27 Feb 2001 15:04:32 -0800


On Thu, Feb 22, 2001 at 03:48:50PM +0100, Trond Myklebust wrote:
>
> The above fixes should ensure that all cookies taking values between 0
> and (2^32-1) on the NFS server are preserved through the 32-bit VFS
> interface, and are accepted by glibc as valid entries. It should also
> work fine with existing 64-bit architectures.
>
> Please could people give this a try, and report if it fixes the
> problems.

Have you tried it against a Linux NFS V3 server? When I log in
with my home directory mounted from a Linux NFS V3 server, I
got kernel oops when I do

# cat /proc/mounts

I think the problem may be cookie transform thing.

> --- linux-2.4.2-fh_align/fs/nfs/nfs3xdr.c Fri Feb 9 20:29:44 2001
> +++ linux-2.4.2-dir/fs/nfs/nfs3xdr.c Thu Feb 22 10:47:49 2001
> @@ -523,6 +523,13 @@
> return 0;
> }
>
> +/* Hack to sign-extending 32-bit cookies */
> +static inline
> +u64 nfs_transform_cookie64(u64 cookie)
> +{
> + return (cookie & 0x80000000) ? (cookie ^ 0xFFFFFFFF00000000) : cookie;
> +}
> +
> /*
> * Encode arguments to readdir call
> */
> @@ -533,7 +540,7 @@
> int buflen, replen;
>
> p = xdr_encode_fhandle(p, args->fh);
> - p = xdr_encode_hyper(p, args->cookie);
> + p = xdr_encode_hyper(p, nfs_transform_cookie64(args->cookie));
> *p++ = args->verf[0];
> *p++ = args->verf[1];
> if (args->plus) {
> @@ -635,6 +642,7 @@
> nfs3_decode_dirent(u32 *p, struct nfs_entry *entry, int plus)
> {
> struct nfs_entry old = *entry;
> + u64 cookie;
>
> if (!*p++) {
> if (!*p)
> @@ -648,7 +656,8 @@
> entry->name = (const char *) p;
> p += XDR_QUADLEN(entry->len);
> entry->prev_cookie = entry->cookie;
> - p = xdr_decode_hyper(p, &entry->cookie);
> + p = xdr_decode_hyper(p, cookie);
> + entry->cookie = nfs_transform_cookie64(cookie);

I don't understand this. As far as I can tell, "cookie" is not
initialized at all. Even if it is initialized, what does

p = xdr_decode_hyper(p, cookie);

do?

H.J.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/