From: David Vrabel <dvrabel@arcom.co.uk>
To: David Woodhouse <dwmw2@infradead.org>
Cc: mtd@infradead.org
Subject: Re: JFFS: deleted files still appear in directory
Date: Mon, 18 Dec 2000 12:08:25 +0000 [thread overview]
Message-ID: <3A3DFE39.2FC5303E@arcom.co.uk> (raw)
In-Reply-To: Pine.LNX.4.30.0012180937270.21997-100000@imladris.demon.co.uk
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
next parent reply other threads:[~2000-12-18 12:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.30.0012180937270.21997-100000@imladris.demon.co.uk>
2000-12-18 12:08 ` David Vrabel [this message]
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
2000-12-14 15:50 David Vrabel
2000-12-14 19:28 ` Micheal Kelly
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=3A3DFE39.2FC5303E@arcom.co.uk \
--to=dvrabel@arcom.co.uk \
--cc=dwmw2@infradead.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.