public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* JFFS: deleted files still appear in directory
@ 2000-12-14 15:50 David Vrabel
  2000-12-14 19:28 ` Micheal Kelly
  0 siblings, 1 reply; 6+ messages in thread
From: David Vrabel @ 2000-12-14 15:50 UTC (permalink / raw)
  To: mtd

Hi,

I'm using the lastest CVS MTD+JFFS with kernel 2.2.18 with the following
result:

# ls
# touch j
# rm j
# ls
ls: ./j: No such file or directory

It appears that readdir() (?) thinks the files exists put stat(), open()
etc. do not.

David Vrabel



To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: JFFS: deleted files still appear in directory
  2000-12-14 15:50 David Vrabel
@ 2000-12-14 19:28 ` Micheal Kelly
  0 siblings, 0 replies; 6+ messages in thread
From: Micheal Kelly @ 2000-12-14 19:28 UTC (permalink / raw)
  To: David Vrabel, mtd

Hi David,

I'm seeing the same thing with kernel 2.4.0-test12-pre7.  I haven't dug into 
the code yet, as I've gotten sidetracked on other things...  I'll probably 
get around to looking at it on Monday.


- Mike K.

--------------------------------------------------
Micheal Kelly
Espial Inc.

On Thursday 14 December 2000 10:50, David Vrabel wrote:
> Hi,
>
> I'm using the lastest CVS MTD+JFFS with kernel 2.2.18 with the following
> result:
>
> # ls
> # touch j
> # rm j
> # ls
> ls: ./j: No such file or directory
>
> It appears that readdir() (?) thinks the files exists put stat(), open()
> etc. do not.
>
> David Vrabel
>
>
>
> To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org


To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: JFFS: deleted files still appear in directory
       [not found] <Pine.LNX.4.30.0012180937270.21997-100000@imladris.demon.co.uk>
@ 2000-12-18 12:08 ` David Vrabel
  0 siblings, 0 replies; 6+ messages in thread
From: David Vrabel @ 2000-12-18 12:08 UTC (permalink / raw)
  To: David Woodhouse; +Cc: mtd

Hi,

I think this problem is fixed by this patch.

David Vrabel.

Index: 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
--- inode-v22.c	2000/12/05 16:03:41	1.54
+++ inode-v22.c	2000/12/18 11:59:42
@@ -575,6 +575,7 @@
 	struct jffs_control *c = (struct jffs_control
*)inode->i_sb->u.generic_sbp;
 	int j;
 	int ddino;
+
 	D3(printk (KERN_NOTICE "readdir(): down biglock\n"));
 	down(&c->fmc->biglock);
 
@@ -604,10 +605,13 @@
 		filp->f_pos++;
 	}
 	f = ((struct jffs_file *)inode->u.generic_ip)->children;
-	for (j = 2; (j < filp->f_pos) && f; j++) {
-	        f = f->sibling_next;
+
+	j=2;
+	while(f && (f->deleted || j++ < filp->f_pos )) {
+		f = f->sibling_next;
 	}
-	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 +621,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: 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
--- inode-v23.c	2000/12/05 16:03:41	1.51
+++ inode-v23.c	2000/12/18 11:59:47
@@ -598,10 +598,13 @@
 		filp->f_pos++;
 	}
 	f = ((struct jffs_file *)inode->u.generic_ip)->children;
-	for (j = 2; (j < filp->f_pos) && f; j++) {
-	        f = f->sibling_next;
+
+	j=2;
+	while(f && (f->deleted || j++ < filp->f_pos )) {
+		f = f->sibling_next;
 	}
-	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 +614,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: intrep.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs/intrep.c,v
retrieving revision 1.82
diff -u -r1.82 intrep.c
--- intrep.c	2000/12/09 03:29:36	1.82
+++ intrep.c	2000/12/18 11:59:56
@@ -1059,12 +1059,11 @@
 		f->atime = raw_inode->atime;
 		f->mtime = raw_inode->mtime;
 		f->ctime = raw_inode->ctime;
-		f->deleted = raw_inode->deleted;
 	}
 	else if ((f->highest_version < node->version)
 		 || (node->version == 0)) {
 		/* Insert at the end of the list.  I.e. this node is the
-		   oldest one so far.  */
+		   newest one so far.  */
 		node->version_prev = f->version_tail;
 		node->version_next = 0;
 		f->version_tail->version_next = node;
@@ -1078,7 +1077,6 @@
 		f->atime = raw_inode->atime;
 		f->mtime = raw_inode->mtime;
 		f->ctime = raw_inode->ctime;
-		f->deleted = raw_inode->deleted;
 	}
 	else if (f->version_head->version > node->version) {
 		/* Insert at the bottom of the list.  */
@@ -1089,9 +1087,6 @@
 		if (!f->name) {
 			update_name = 1;
 		}
-		if (raw_inode->deleted) {
-			f->deleted = raw_inode->deleted;
-		}
 	}
 	else {
 		struct jffs_node *n;
@@ -1115,6 +1110,12 @@
 		}
 	}
 
+	/* Deletion is irreversible. If any 'deleted' node is ever
+	   written, the file is deleted */
+	if (raw_inode->deleted) {
+		f->deleted = raw_inode->deleted;
+	}
+
 	/* Perhaps update the name.  */
 	if (raw_inode->nsize && update_name && name && *name && (name !=
f->name)) {
 		if (f->name) {
@@ -1647,6 +1648,9 @@
 		printk(KERN_ERR "JFFS: jffs_write_node: Failed to write, "
 		       "requested %i, wrote %i\n", total_size, err);
 		goto retry;
+	}
+	if (raw_inode->deleted) {
+		f->deleted = 1;
 	}
 
 	jffs_fm_write_unlock(fmc);



To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: JFFS: deleted files still appear in directory
@ 2000-12-18 13:01 Simon Munton
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Munton @ 2000-12-18 13:01 UTC (permalink / raw)
  To: mtd

There's still a problem with the following sequence of commands:

# touch foo
# touch bar
# mv foo bar
# rm bar
rm: cannot unlink `bar': Input/output error

JFFS debug output:
jffs_create(): dir: 0xc0f20144, name: "foo"
jffs_write_node(): filename = "foo", ino = 2, total_size = 64
jffs_fmalloc(): fmc = 0xc0f873f0, size = 64, node = 0xc000b720
jffs_insert_node(): ino = 2, version = 1, name = "foo", deleted = 0
thread_should_wake(): free=8257472, dirty=0, blocksize=131072.
jffs_create(): dir: 0xc0f20144, name: "bar"
jffs_write_node(): filename = "bar", ino = 3, total_size = 64
jffs_fmalloc(): fmc = 0xc0f873f0, size = 64, node = 0xc000b630
jffs_insert_node(): ino = 3, version = 1, name = "bar", deleted = 0
thread_should_wake(): free=8257408, dirty=0, blocksize=131072.
***jffs_rename()
jffs_rename(): old_dir: 0xc0f20144, old name: 0xc0f1e760, new_dir:
0xc0f20144, new name: 0xc0f1e860
jffs_write_node(): filename = "bar", ino = 2, total_size = 68
jffs_fmalloc(): fmc = 0xc0f873f0, size = 68, node = 0xc000b770
jffs_write_node(): setting version of foo to 2
***jffs_remove(): file = "bar", ino = 3
jffs_write_node(): filename = "", ino = 3, total_size = 60
jffs_fmalloc(): fmc = 0xc0f873f0, size = 60, node = 0xc000b590
jffs_write_node(): setting version of bar to 2
jffs_insert_node(): ino = 3, version = 2, name = "", deleted = 1
thread_should_wake(): free=8257280, dirty=0, blocksize=131072.
jffs_insert_node(): ino = 2, version = 2, name = "bar", deleted = 0
jffs_remove_redundant_nodes(): Removing node: ino: 2, version: 1, mod_type:
3
jffs_fmfree(): node->ino = 2, node->version = 1
thread_should_wake(): free=8257280, dirty=64, blocksize=131072.
***jffs_remove(): file = "bar", ino = 2
jffs_remove(): wrong inodes


Simon

========================================================
Simon Munton	simonm@m4data.co.uk
M4 Data Ltd	Tel: 44-1749-683800
Mendip Court, Bath Rd, Wells	Fax: 44-1749-673928
Somerset, BA5 3DG, England


> -----Original Message-----
> From: David Vrabel [mailto:dvrabel@arcom.co.uk]
> Sent: 18 December 2000 12:08 pm
> To: David Woodhouse
> Cc: mtd@infradead.org
> Subject: Re: JFFS: deleted files still appear in directory
> 
> 
> Hi,
> 
> I think this problem is fixed by this patch.
> 
> David Vrabel.


To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: JFFS: deleted files still appear in directory
@ 2000-12-18 13:13 Simon Munton
  2000-12-18 13:17 ` David Woodhouse
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Munton @ 2000-12-18 13:13 UTC (permalink / raw)
  To: David Woodhouse, jffs-dev, mtd

Yep, that fixed it. I'll try and break something else now.

Simon

> -----Original Message-----
> From: David Woodhouse [mailto:dwmw2@infradead.org]
> Sent: 18 December 2000 01:06 pm
> To: Simon Munton; jffs-dev@axis.com
> Subject: Re: JFFS: deleted files still appear in directory 
> 
> 
> 
> Simon.Munton@m4data.co.uk said:
> > There's still a problem with the following sequence of commands:
> > # touch foo 
> > # touch bar
> > # mv foo bar
> > # rm bar
> > rm: cannot unlink `bar': Input/output error 
> 
> Hopefully that's fixed by the change to jffs_find_child() 
> which I just 
> committed.
> 
> 
> --
> dwmw2
> 
> 


To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: JFFS: deleted files still appear in directory
  2000-12-18 13:13 JFFS: deleted files still appear in directory Simon Munton
@ 2000-12-18 13:17 ` David Woodhouse
  0 siblings, 0 replies; 6+ messages in thread
From: David Woodhouse @ 2000-12-18 13:17 UTC (permalink / raw)
  To: Simon Munton; +Cc: jffs-dev, mtd


Simon.Munton@m4data.co.uk said:
> Yep, that fixed it. I'll try and break something else now. 

Yeah - you're definitely slacking if you're finding bugs I've already fixed 
:)

Concentrate on bugs centred around unlink(). There's probably something we 
haven't considered yet.

--
dwmw2




To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-12-18 13:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-18 13:13 JFFS: deleted files still appear in directory Simon Munton
2000-12-18 13:17 ` David Woodhouse
  -- strict thread matches above, loose matches on Subject: below --
2000-12-18 13:01 Simon Munton
     [not found] <Pine.LNX.4.30.0012180937270.21997-100000@imladris.demon.co.uk>
2000-12-18 12:08 ` David Vrabel
2000-12-14 15:50 David Vrabel
2000-12-14 19:28 ` Micheal Kelly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox