* JFFS: rmdir wierdness
@ 2000-12-18 12:49 David Vrabel
2000-12-18 13:02 ` David Woodhouse
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: David Vrabel @ 2000-12-18 12:49 UTC (permalink / raw)
To: mtd
Hi,
# mkdir a
# ls
a
# rmdir a
# ls
# mkdir a
mkdir: a: File exists
Also
# mkdir b
# touch b/a
# rm b/a
# rmdir b
rmdir: b: Directory not empty
rmdir() thinks `b' still has children (I think).
This was done with the latest CVS with kernel 2.2.18.
David Vrabel.
To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: JFFS: rmdir wierdness
2000-12-18 12:49 JFFS: rmdir wierdness David Vrabel
@ 2000-12-18 13:02 ` David Woodhouse
2000-12-18 13:04 ` David Vrabel
2000-12-18 14:18 ` David Vrabel
2 siblings, 0 replies; 4+ messages in thread
From: David Woodhouse @ 2000-12-18 13:02 UTC (permalink / raw)
To: David Vrabel; +Cc: mtd, jffs-dev
dvrabel@arcom.co.uk said:
> # mkdir a
> # ls
> a
> # rmdir a
> # ls
> # mkdir a
> mkdir: a: File exists
>
> Also
>
> # mkdir b
> # touch b/a
> # rm b/a
> # rmdir b
> rmdir: b: Directory not empty
>
> rmdir() thinks `b' still has children (I think).
More problems with the deletion code since I did the use counts.
Hmmm. This was sort of why I didn't want to commit it immediately, till I'd
had time to do some sanity checks on it.
Try this:
Index: intrep.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs/intrep.c,v
retrieving revision 1.84
diff -u -r1.84 intrep.c
--- intrep.c 2000/12/18 13:00:23 1.84
+++ intrep.c 2000/12/18 13:02:30
@@ -1387,7 +1387,7 @@
D3(printk("jffs_find_child()\n"));
for (f = dir->children; f; f = f->sibling_next) {
- if (f->name
+ if (!f->deleted && f->name
&& !strncmp(f->name, name, len)
&& f->name[len] == '\0') {
break;
--
dwmw2
To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: JFFS: rmdir wierdness
2000-12-18 12:49 JFFS: rmdir wierdness David Vrabel
2000-12-18 13:02 ` David Woodhouse
@ 2000-12-18 13:04 ` David Vrabel
2000-12-18 14:18 ` David Vrabel
2 siblings, 0 replies; 4+ messages in thread
From: David Vrabel @ 2000-12-18 13:04 UTC (permalink / raw)
To: mtd
Hi,
Are these problems anything to do with jffs_find_child() not ignoring
deleted files?
David Vrabel
To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: JFFS: rmdir wierdness
2000-12-18 12:49 JFFS: rmdir wierdness David Vrabel
2000-12-18 13:02 ` David Woodhouse
2000-12-18 13:04 ` David Vrabel
@ 2000-12-18 14:18 ` David Vrabel
2 siblings, 0 replies; 4+ messages in thread
From: David Vrabel @ 2000-12-18 14:18 UTC (permalink / raw)
To: mtd
Hi,
> # mkdir a
> # ls
> a
> # rmdir a
> # ls
> # mkdir a
> mkdir: a: File exists
This one has been fixed.
> # mkdir b
> # touch b/a
> # rm b/a
> # rmdir b
> rmdir: b: Directory not empty
This one is still broken.
In jffs_remove():
if (S_ISDIR(type)) {
/* ... */
if (del_f->children) {
result = -ENOTEMPTY;
goto jffs_remove_end;
}
}
As I understand it del_f->children is the head of a list of the
directory's children. If this is the case then won't you have to go
through the list checking that all the children have been deleted? Find
a patch that does just this (it works too).
David Vrabel.
Index: inode-v22.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs/inode-v22.c,v
retrieving revision 1.55
diff -u -r1.55 inode-v22.c
--- inode-v22.c 2000/12/18 12:11:08 1.55
+++ inode-v22.c 2000/12/18 14:05:50
@@ -960,14 +960,20 @@
}
if (S_ISDIR(type)) {
+ struct jffs_file *child=del_f->children;
+
result = -ENOTDIR;
if (!S_ISDIR(del_f->mode)) { /* Is this really needed
for 2.2? */
D(printk("jffs_remove(): S_ISDIR but isn't\n"));
goto jffs_remove_end;
}
- if (del_f->children) {
- result = -ENOTEMPTY;
- goto jffs_remove_end;
+
+ while(child) {
+ if( !child->deleted ) {
+ result = -ENOTEMPTY;
+ goto jffs_remove_end;
+ }
+ child = child->sibling_next;
}
}
else if (S_ISDIR(del_f->mode)) {
Index: inode-v23.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs/inode-v23.c,v
retrieving revision 1.52
diff -u -r1.52 inode-v23.c
--- inode-v23.c 2000/12/18 12:11:08 1.52
+++ inode-v23.c 2000/12/18 14:05:56
@@ -956,11 +956,15 @@
}
if (S_ISDIR(type)) {
- if (del_f->children) {
- result = -ENOTEMPTY;
- goto jffs_remove_end;
+ struct jffs_file *child=del_f->children;
+ while(child) {
+ if( !child->deleted ) {
+ result = -ENOTEMPTY;
+ goto jffs_remove_end;
+ }
+ child = child->sibling_next;
}
- }
+ }
else if (S_ISDIR(del_f->mode)) {
D(printk("jffs_remove(): node is a directory "
"but it shouldn't be.\n"));
To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-12-18 14:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-18 12:49 JFFS: rmdir wierdness David Vrabel
2000-12-18 13:02 ` David Woodhouse
2000-12-18 13:04 ` David Vrabel
2000-12-18 14:18 ` David Vrabel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox