Re: [RFC] readdir mess

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---

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-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux