2009-07-23 17:33:18

by Latchesar Ionkov

[permalink] [raw]
Subject: [PATCH] 9p: reset the stat buffer offset after each read

The stat buffer offset variable (i) is set to zero at the beginning of
the v9fs_dir_readdir function. It should be reset to 0 each time data
is read from the file server.

Signed-off-by: Latchesar Ionkov <[email protected]>

diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 873cd31..9b0525f 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -74,7 +74,7 @@ static int v9fs_dir_readdir(struct file *filp, void
*dirent, filldir_t filldir)
struct p9_fid *fid;
int buflen;
char *statbuf;
- int n, i = 0;
+ int n, i;

P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
fid = filp->private_data;
@@ -90,6 +90,7 @@ static int v9fs_dir_readdir(struct file *filp, void
*dirent, filldir_t filldir)
if (err <= 0)
break;

+ i = 0;
n = err;
while (i < n) {
err = p9stat_read(statbuf + i, buflen-i, &st,