Bug 15572
Summary: | Bug on JFFS2: some nodes are written back with old size | ||
---|---|---|---|
Product: | File System | Reporter: | ppkwuxuan (wux) |
Component: | Other | Assignee: | David Woodhouse (dwmw2) |
Status: | RESOLVED CODE_FIX | ||
Severity: | normal | CC: | akpm |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | Linux-2.6.24.7 | Subsystem: | |
Regression: | No | Bisected commit-id: |
Description
ppkwuxuan
2010-03-18 08:52:46 UTC
Hi, Dave ;) Hm, f->sem is supposed to protect against garbage collection from happening while we're processing a write -- but we're updating the isize after we drop f->sem, which opens up the race condition. Thank you very much for your excellent diagnosis -- it looks entirely sane to me. If you're right, this patch should 'fix' it, and then we'll look for a cleaner way to achieve the same thing (and worry about the rules for updating inode->i_size)... --- a/fs/jffs2/write.c +++ b/fs/jffs2/write.c @@ -392,6 +392,8 @@ int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, } break; } + JFFS2_F_I_SIZE(f) = je32_to_cpu(ri->isize); + ret = jffs2_add_full_dnode_to_inode(c, f, fn); if (f->metadata) { jffs2_mark_node_obsolete(c, f->metadata->raw); |