From: "H . J . Lu" <hjl@valinux.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: NFS maillist <nfs@lists.sourceforge.net>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [NFS] Updated patch for the [2.4.x] NFS 'missing directory entry a.k.a. IRIX server' problem...
Date: Mon, 26 Feb 2001 15:28:26 -0800 [thread overview]
Message-ID: <20010226152826.A20653@valinux.com> (raw)
In-Reply-To: <14997.9938.106305.635202@charged.uio.no>
In-Reply-To: <14997.9938.106305.635202@charged.uio.no>; from trond.myklebust@fys.uio.no on Thu, Feb 22, 2001 at 03:48:50PM +0100
On Thu, Feb 22, 2001 at 03:48:50PM +0100, Trond Myklebust wrote:
>
> Hi,
>
> After having tried to thrash out what exactly is the kernel
> interface for telldir/seekdir w.r.t. the existence of negative offsets
> with the glibc people, I've finally found a way to work within the
> current scheme.
>
> The problem at hand is that we currently would like to support the
> existence of directory cookies that take unsigned 32-bit values in
> NFSv2, unsigned 64-bit values in NFSv3.
>
> Given that most NFSv3 servers can/do use 32-bit cookies for
> compatibility with 32-bit systems, we would like to be able to pass
> this type of cookie back up to userland for use by the 32-bit
> interface.
> However the interface chosen both in glibc and partly in the kernel
> itself assumes all cookies are 32-bit signed values. Thus you have to
> find a way to cope with the kernel and glibc sign extending (almost)
> all cookies which have bit 31 set.
>
> The following patch therefore does 3 things:
>
> - Patch linux/fs/readdir.c so that file->f_pos is copied into the
> dirent64 structure with sign extension. This is for consistency
> with the behaviour of filldir64.
>
> - Patch NFSv2 xdr routines so that 32-bit cookies get extended to
> take 64-bit signed values (as opposed to unsigned values) for
> consistency with the fact that (l|)off_t are both signed.
>
> - Patch NFSv3 xdr routines with a hack that mimics sign extension
> on those cookies which are truly 32-bit unsigned.
> To do this we use the transformation
>
> (cookie & 0x80000000) ? cookie ^ 0xFFFFFFFF00000000 : cookie;
>
> Note that this a transformation has no effect on true 64-bit
> cookies because it is reversible.
>
> - Make a special version of 'lseek()' for NFS directories that
> returns 0 if the offset used was negative (rather than returning
> the offset itself). This avoids userland misinterpreting the
> return value as an error.
>
> 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.
>
I don't know how it will work with real 64bit cookies on a 32bit
host for NFS V3 since you truncate it into 32bit during sign
extension.
H.J.
next prev parent reply other threads:[~2001-02-26 23:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-22 14:48 Updated patch for the [2.4.x] NFS 'missing directory entry a.k.a. IRIX server' problem Trond Myklebust
2001-02-26 23:28 ` H . J . Lu [this message]
2001-02-27 6:57 ` [NFS] " Trond Myklebust
2001-02-27 7:06 ` H . J . Lu
2001-02-27 7:41 ` Trond Myklebust
2001-02-27 19:12 ` Jamie Lokier
2001-02-27 23:04 ` H . J . Lu
2001-02-27 23:24 ` H . J . Lu
2001-02-28 11:19 ` Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010226152826.A20653@valinux.com \
--to=hjl@valinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nfs@lists.sourceforge.net \
--cc=trond.myklebust@fys.uio.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.