All of lore.kernel.org
 help / color / mirror / Atom feed
* Readdirplus compatibility fix for IRIX server
@ 2003-12-10 22:48 Steve Dickson
  2003-12-11  0:48 ` Trond Myklebust
  0 siblings, 1 reply; 4+ messages in thread
From: Steve Dickson @ 2003-12-10 22:48 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: nfs

[-- 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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-12-11 11:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-10 22:48 Readdirplus compatibility fix for IRIX server Steve Dickson
2003-12-11  0:48 ` Trond Myklebust
2003-12-11  2:03   ` Greg Banks
2003-12-11 11:11   ` Steve Dickson

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.