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

Re: JFFS: deleted files still appear in directory




dvrabel@xxxxxxx.uk said:
>  It appears that readdir() (?) thinks the files exists put stat(),
> open() etc. do not. 


Try this. It might compile :)

Index: fs/jffs/inode-v22.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs/inode-v22.c,v
retrieving revision 1.54
diff -u -r1.54 inode-v22.c
--- fs/jffs/inode-v22.c	2000/12/05 16:03:41	1.54
+++ fs/jffs/inode-v22.c	2000/12/14 15:53:56
@@ -605,9 +605,11 @@
 	}
 	f = ((struct jffs_file *)inode->u.generic_ip)->children;
 	for (j = 2; (j < filp->f_pos) && f; j++) {
-	        f = f->sibling_next;
+	        do {
+			f = f->sibling_next;
+		} while(f && f->deleted)
 	}
-	for (; f ; f = f->sibling_next) {
+	while (f) {
 		D3(printk("jffs_readdir(): \"%s\" ino: %u\n",
 			  (f->name ? f->name : ""), f->ino));
 		if (filldir(dirent, f->name, f->nsize,
@@ -617,6 +619,9 @@
 			return 0;
 		}
 		filp->f_pos++;
+		do {
+			f = f->sibling_next;
+		} while(f && f->deleted);
 	}
 	D3(printk (KERN_NOTICE "readdir(): up biglock\n"));
 	up(&c->fmc->biglock);
Index: fs/jffs/inode-v23.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs/inode-v23.c,v
retrieving revision 1.51
diff -u -r1.51 inode-v23.c
--- fs/jffs/inode-v23.c	2000/12/05 16:03:41	1.51
+++ fs/jffs/inode-v23.c	2000/12/14 15:53:57
@@ -599,9 +599,11 @@
 	}
 	f = ((struct jffs_file *)inode->u.generic_ip)->children;
 	for (j = 2; (j < filp->f_pos) && f; j++) {
-	        f = f->sibling_next;
+	        do {
+			f = f->sibling_next;
+		} while(f && f->deleted)
 	}
-	for (; f ; f = f->sibling_next) {
+	while (f) {
 		D3(printk("jffs_readdir(): \"%s\" ino: %u\n",
 			  (f->name ? f->name : ""), f->ino));
 		if (filldir(dirent, f->name, f->nsize,
@@ -611,6 +613,9 @@
 			return 0;
 		}
 		filp->f_pos++;
+		do {
+			f = f->sibling_next;
+		} while(f && f->deleted);
 	}
 	D3(printk (KERN_NOTICE "readdir(): up biglock\n"));
 	up(&c->fmc->biglock);


--
dwmw2



To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to majordomo@xxxxxxx.com