diff options
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/build.c | 9 | ||||
-rw-r--r-- | fs/jffs2/nodemgmt.c | 11 |
2 files changed, 12 insertions, 8 deletions
diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c index a01dd5fdbb95..3dd5394921c9 100644 --- a/fs/jffs2/build.c +++ b/fs/jffs2/build.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: build.c,v 1.69 2004/12/16 20:22:18 dmarlin Exp $ | 10 | * $Id: build.c,v 1.70 2005/02/28 08:21:05 dedekind Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -97,14 +97,16 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c) | |||
97 | /* First, scan the medium and build all the inode caches with | 97 | /* First, scan the medium and build all the inode caches with |
98 | lists of physical nodes */ | 98 | lists of physical nodes */ |
99 | 99 | ||
100 | c->flags |= JFFS2_SB_FLAG_MOUNTING; | 100 | c->flags |= JFFS2_SB_FLAG_SCANNING; |
101 | ret = jffs2_scan_medium(c); | 101 | ret = jffs2_scan_medium(c); |
102 | c->flags &= ~JFFS2_SB_FLAG_SCANNING; | ||
102 | if (ret) | 103 | if (ret) |
103 | goto exit; | 104 | goto exit; |
104 | 105 | ||
105 | D1(printk(KERN_DEBUG "Scanned flash completely\n")); | 106 | D1(printk(KERN_DEBUG "Scanned flash completely\n")); |
106 | D2(jffs2_dump_block_lists(c)); | 107 | D2(jffs2_dump_block_lists(c)); |
107 | 108 | ||
109 | c->flags |= JFFS2_SB_FLAG_BUILDING; | ||
108 | /* Now scan the directory tree, increasing nlink according to every dirent found. */ | 110 | /* Now scan the directory tree, increasing nlink according to every dirent found. */ |
109 | for_each_inode(i, c, ic) { | 111 | for_each_inode(i, c, ic) { |
110 | D1(printk(KERN_DEBUG "Pass 1: ino #%u\n", ic->ino)); | 112 | D1(printk(KERN_DEBUG "Pass 1: ino #%u\n", ic->ino)); |
@@ -116,7 +118,6 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c) | |||
116 | cond_resched(); | 118 | cond_resched(); |
117 | } | 119 | } |
118 | } | 120 | } |
119 | c->flags &= ~JFFS2_SB_FLAG_MOUNTING; | ||
120 | 121 | ||
121 | D1(printk(KERN_DEBUG "Pass 1 complete\n")); | 122 | D1(printk(KERN_DEBUG "Pass 1 complete\n")); |
122 | 123 | ||
@@ -164,6 +165,8 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c) | |||
164 | ic->scan_dents = NULL; | 165 | ic->scan_dents = NULL; |
165 | cond_resched(); | 166 | cond_resched(); |
166 | } | 167 | } |
168 | c->flags &= ~JFFS2_SB_FLAG_BUILDING; | ||
169 | |||
167 | D1(printk(KERN_DEBUG "Pass 3 complete\n")); | 170 | D1(printk(KERN_DEBUG "Pass 3 complete\n")); |
168 | D2(jffs2_dump_block_lists(c)); | 171 | D2(jffs2_dump_block_lists(c)); |
169 | 172 | ||
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c index f9dcac1415ac..456adf020f22 100644 --- a/fs/jffs2/nodemgmt.c +++ b/fs/jffs2/nodemgmt.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: nodemgmt.c,v 1.118 2005/02/27 23:01:32 dwmw2 Exp $ | 10 | * $Id: nodemgmt.c,v 1.119 2005/02/28 08:21:05 dedekind Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -403,7 +403,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref | |||
403 | jeb = &c->blocks[blocknr]; | 403 | jeb = &c->blocks[blocknr]; |
404 | 404 | ||
405 | if (jffs2_can_mark_obsolete(c) && !jffs2_is_readonly(c) && | 405 | if (jffs2_can_mark_obsolete(c) && !jffs2_is_readonly(c) && |
406 | !(c->flags & JFFS2_SB_FLAG_MOUNTING)) { | 406 | !(c->flags & (JFFS2_SB_FLAG_SCANNING | JFFS2_SB_FLAG_BUILDING))) { |
407 | /* Hm. This may confuse static lock analysis. If any of the above | 407 | /* Hm. This may confuse static lock analysis. If any of the above |
408 | three conditions is false, we're going to return from this | 408 | three conditions is false, we're going to return from this |
409 | function without actually obliterating any nodes or freeing | 409 | function without actually obliterating any nodes or freeing |
@@ -470,8 +470,8 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref | |||
470 | 470 | ||
471 | D1(ACCT_PARANOIA_CHECK(jeb)); | 471 | D1(ACCT_PARANOIA_CHECK(jeb)); |
472 | 472 | ||
473 | if (c->flags & JFFS2_SB_FLAG_MOUNTING) { | 473 | if (c->flags & JFFS2_SB_FLAG_SCANNING) { |
474 | /* Mount in progress. Don't muck about with the block | 474 | /* Flash scanning is in progress. Don't muck about with the block |
475 | lists because they're not ready yet, and don't actually | 475 | lists because they're not ready yet, and don't actually |
476 | obliterate nodes that look obsolete. If they weren't | 476 | obliterate nodes that look obsolete. If they weren't |
477 | marked obsolete on the flash at the time they _became_ | 477 | marked obsolete on the flash at the time they _became_ |
@@ -530,7 +530,8 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref | |||
530 | 530 | ||
531 | spin_unlock(&c->erase_completion_lock); | 531 | spin_unlock(&c->erase_completion_lock); |
532 | 532 | ||
533 | if (!jffs2_can_mark_obsolete(c) || jffs2_is_readonly(c)) { | 533 | if (!jffs2_can_mark_obsolete(c) || jffs2_is_readonly(c) || |
534 | (c->flags & JFFS2_SB_FLAG_BUILDING)) { | ||
534 | /* We didn't lock the erase_free_sem */ | 535 | /* We didn't lock the erase_free_sem */ |
535 | return; | 536 | return; |
536 | } | 537 | } |