Linux NFS development
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: nfs@lists.sourceforge.net
Subject: Readdirplus compatibility fix for IRIX server
Date: Wed, 10 Dec 2003 17:48:01 -0500	[thread overview]
Message-ID: <3FD7A2A1.1030109@RedHat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1841 bytes --]

Hey Trond,

There is a compatibly issue with the linux-2.4.X-X-rdplus.dif
patch on your website and IRIX servers.

The scenario is:

mount irix:/server /mnt/irix
cd /mnt/irix;
mkdir dir; touch dir/file;
rm -rf dir # fails with an -525 error code (ETOOSMALL)

The problem happens when nfs_readdir() sends an "old"
cookie  (via uncached_readdir())

        res = readdir_search_pagecache(desc);
        if (res == -EBADCOOKIE) {
            /* This means either end of directory */
            if (desc->entry->cookie != desc->target) {
                /* Or that the server has 'lost' a cookie */
                res = uncached_readdir(desc, dirent, filldir);
                if (res >= 0)
                    continue;
            }

It seems IRIX servers fails READDIRPLUS calls with
NFSERR_TOOSMALL when the cookie does not exist which
is *not* the case with "normal" READDIR calls...
Cute uh...

Now one way to handle this is to simply ignore this
error case..
            if (res == -EIO)
                desc->error = 0;

since uncached_readdir() will always return -EIO when
the RPC call fails (which does work)....

But I got to wondering.... why is that last readdir RPC
even needed when the server *has* already set the EOF bit?

Since the server is telling client there is no more data,
is there really a need for that final readdir RPC? Now
if there is a cookie mismatch and the EOF bit is not set
then I (guess) can see the need for another RPC... But in the
"normal" case it appears that extra RPC is not needed....
(Note: This extra RPC happens with both READDIR and READDIRPLUSs
it does affect the stock kernels and it seems to happen with
non-linux servers, like netapp and IRIX)

The attached patch eliminates the extra RPC (when not
needed) which in turn takes care of the IRIX incompatibly
problem....

Comments?

SteveD.

[-- Attachment #2: linux-2.4.22-nfs-readdirplus-irix.patch --]
[-- Type: text/plain, Size: 557 bytes --]

--- linux-2.4.22/fs/nfs/dir.c.org	2003-12-09 14:21:59.000000000 -0500
+++ linux-2.4.22/fs/nfs/dir.c	2003-12-10 16:49:28.000000000 -0500
@@ -431,7 +431,8 @@ static int nfs_readdir(struct file *filp
 		res = readdir_search_pagecache(desc);
 		if (res == -EBADCOOKIE) {
 			/* This means either end of directory */
-			if (desc->entry->cookie != desc->target) {
+			if (desc->entry->eof == 0 &&
+				desc->entry->cookie != desc->target) {
 				/* Or that the server has 'lost' a cookie */
 				res = uncached_readdir(desc, dirent, filldir);
 				if (res >= 0)

             reply	other threads:[~2003-12-10 22:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-10 22:48 Steve Dickson [this message]
2003-12-11  0:48 ` Readdirplus compatibility fix for IRIX server Trond Myklebust
2003-12-11  2:03   ` Greg Banks
2003-12-11 11:11   ` Steve Dickson

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=3FD7A2A1.1030109@RedHat.com \
    --to=steved@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox