[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080815050613.GJ4422@cs.cmu.edu>
Date: Fri, 15 Aug 2008 01:06:13 -0400
From: Jan Harkes <jaharkes@...cmu.edu>
To: Al Viro <viro@...IV.linux.org.uk>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC] readdir mess
On Wed, Aug 13, 2008 at 01:04:33AM +0100, Al Viro wrote:
> coda: returns fsck knows what (number of entries, mostly)
Not sure either and I was the one that sent the patch that introduced
that. My closest guess would be that I looked too long at a getdents(2)
manpage, but then again it doesn't really match that either.
Signed-off-by: Jan Harkes <jaharkes@...cmu.edu>
---
If I understood your description, then the following would be the
correct fix. We return 0 as long as we managed to read some entries, and
any non-zero return value from filldir otherwise.
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index c591622..6026b91 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -513,14 +513,14 @@ static int coda_venus_readdir(struct file *coda_file, void *buf,
if (coda_file->f_pos == 0) {
ret = filldir(buf, ".", 1, 0, de->d_inode->i_ino, DT_DIR);
- if (ret < 0)
+ if (ret != 0)
goto out;
result++;
coda_file->f_pos++;
}
if (coda_file->f_pos == 1) {
ret = filldir(buf, "..", 2, 1, de->d_parent->d_inode->i_ino, DT_DIR);
- if (ret < 0)
+ if (ret != 0)
goto out;
result++;
coda_file->f_pos++;
@@ -572,7 +572,7 @@ static int coda_venus_readdir(struct file *coda_file, void *buf,
ret = filldir(buf, name.name, name.len,
coda_file->f_pos, ino, type);
/* failure means no space for filling in this round */
- if (ret < 0) break;
+ if (ret != 0) break;
result++;
}
/* we'll always have progress because d_reclen is unsigned and
@@ -581,7 +581,7 @@ static int coda_venus_readdir(struct file *coda_file, void *buf,
}
out:
kfree(vdir);
- return result ? result : ret;
+ return result ? 0 : ret;
}
/* called when a cache lookup succeeds */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists