diff mbox

[V9fs-developer] fs/9p: re-init the wstat in readdir loop

Message ID 1267457280-19915-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com (mailing list archive)
State Changes Requested, archived
Delegated to: Eric Van Hensbergen
Headers show

Commit Message

Aneesh Kumar K.V March 1, 2010, 3:28 p.m. UTC
None
diff mbox

Patch

diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 15cce53..0b0ea64 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -131,8 +131,8 @@  static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
 			rdir->head = 0;
 			rdir->tail = err;
 		}
-
 		while (rdir->head < rdir->tail) {
+			p9stat_init(&st);
 			err = p9stat_read(rdir->buf + rdir->head,
 						buflen - rdir->head, &st,
 						fid->clnt->dotu);
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index fb00b32..f48f093 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -208,6 +208,7 @@  void p9_client_cb(struct p9_client *c, struct p9_req_t *req);
 int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int);
 int p9stat_read(char *, int, struct p9_wstat *, int);
 void p9stat_free(struct p9_wstat *);
+void p9stat_init(struct p9_wstat *);
 
 
 #endif /* NET_9P_CLIENT_H */
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index fc70147..5097e93 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -91,6 +91,15 @@  p9pdu_dump(int way, struct p9_fcall *pdu)
 #endif
 EXPORT_SYMBOL(p9pdu_dump);
 
+void p9stat_init(struct p9_wstat *stbuf)
+{
+	stbuf->name  = NULL;
+	stbuf->uid   = NULL;
+	stbuf->gid   = NULL;
+	stbuf->muid  = NULL;
+	stbuf->extension = NULL;
+}
+
 void p9stat_free(struct p9_wstat *stbuf)
 {
 	kfree(stbuf->name);