aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorEstelle Hammache <estelle.hammache@st.com>2005-01-24 16:13:42 -0500
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-05-23 06:11:28 -0400
commite4803c30d64391d84635061eaebfc7d66de9d6ab (patch)
treeb36dbc4306c6b8223f0fd9755ea0d8a04a15bcb6 /fs/jffs2
parented3786a599f5639c99dfcceaef1b064ab5e2e9f9 (diff)
[JFFS2] Fix write buffer retry case
Correction of retry case to avoid silent failure of rmdir when jffs2_wbuf_recover GCs the previous entry (+ corresponding dnode case). Signed-off-by: Estelle Hammache <estelle.hammache@st.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/write.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c
index 80a5db542629..32c1efaf6a0f 100644
--- a/fs/jffs2/write.c
+++ b/fs/jffs2/write.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: write.c,v 1.87 2004/11/16 20:36:12 dwmw2 Exp $ 10 * $Id: write.c,v 1.88 2005/01/24 21:13:39 hammache Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -136,6 +136,21 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
136 raw->__totlen = PAD(sizeof(*ri)+datalen); 136 raw->__totlen = PAD(sizeof(*ri)+datalen);
137 raw->next_phys = NULL; 137 raw->next_phys = NULL;
138 138
139 if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(ri->version) < f->highest_version))
140 {
141 if (! retried)
142 {
143 BUG();
144 }
145 else
146 {
147 D1(printk(KERN_DEBUG "jffs2_write_dnode : dnode_version %d, highest version %d -> updating dnode\n",
148 je32_to_cpu(ri->version), f->highest_version));
149 ri->version = cpu_to_je32(++f->highest_version);
150 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
151 }
152 }
153
139 ret = jffs2_flash_writev(c, vecs, cnt, flash_ofs, &retlen, 154 ret = jffs2_flash_writev(c, vecs, cnt, flash_ofs, &retlen,
140 (alloc_mode==ALLOC_GC)?0:f->inocache->ino); 155 (alloc_mode==ALLOC_GC)?0:f->inocache->ino);
141 156
@@ -280,6 +295,22 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
280 raw->__totlen = PAD(sizeof(*rd)+namelen); 295 raw->__totlen = PAD(sizeof(*rd)+namelen);
281 raw->next_phys = NULL; 296 raw->next_phys = NULL;
282 297
298 if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(rd->version) < f->highest_version))
299 {
300 if (! retried)
301 {
302 BUG();
303 }
304 else
305 {
306 D1(printk(KERN_DEBUG "jffs2_write_dirent : dirent_version %d, highest version %d -> updating dirent\n",
307 je32_to_cpu(rd->version), f->highest_version));
308 rd->version = cpu_to_je32(++f->highest_version);
309 fd->version = je32_to_cpu(rd->version);
310 rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
311 }
312 }
313
283 ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen, 314 ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen,
284 (alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino)); 315 (alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino));
285 if (ret || (retlen != sizeof(*rd) + namelen)) { 316 if (ret || (retlen != sizeof(*rd) + namelen)) {