From: David Vrabel <dvrabel@arcom.co.uk>
To: mtd@infradead.org
Subject: Re: JFFS: rmdir wierdness
Date: Mon, 18 Dec 2000 14:18:28 +0000 [thread overview]
Message-ID: <3A3E1CB4.F4BF34DB@arcom.co.uk> (raw)
In-Reply-To: 3A3E07C4.22A3F127@arcom.co.uk
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
prev parent reply other threads:[~2000-12-18 14:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3A3E1CB4.F4BF34DB@arcom.co.uk \
--to=dvrabel@arcom.co.uk \
--cc=mtd@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox