#4538: mutex is not initilaized in jffs2_read_inode
---------------------------+-----------------------
Reporter: chenjin_zhong | Owner: (none)
Type: defect | Status: reopened
Priority: normal | Milestone: 5.1
Component: fs/jaffs2 | Version: 5
Severity: normal | Resolution:
Keywords: | Blocked By:
Blocking: |
---------------------------+-----------------------
Changes (by chenjin_zhong):
* status: closed => reopened
* resolution: invalid =>
Comment:
Replying to [comment:1 Sebastian Huber]:
> Thanks for your interest in the RTEMS port of JFFS2. If you have
questions, then you could also ask them on the [email protected] mailing
list. The RTEMS port of JFFS2 does not use a file system internal locking.
There is a global lock for each JFFS2 instance:
> {{{#!c
> static void rtems_jffs2_do_lock(struct super_block *sb)
> {
> rtems_recursive_mutex_lock(&sb->s_mutex);
> }
>
> static void rtems_jffs2_do_unlock(struct super_block *sb)
> {
> rtems_recursive_mutex_unlock(&sb->s_mutex);
> }
> }}}
I have compared it with Linux JFFS2. The peice of source code in Linux is
as follows,As shown in black-body section, the f->sem is not be
initialized and locked in RTEMS.
{{{
struct jffs2_sb_info *c;
struct jffs2_raw_inode latest_node;
union jffs2_device_node jdev;
struct inode *inode;
dev_t rdev = 0;
int ret;
jffs2_dbg(1, "%s(): ino == %lu\n", func, ino);
inode = iget_locked(sb, ino);
if (!inode)
return ERR_PTR(-ENOMEM);
if (!(inode->i_state & I_NEW))
return inode;
f = JFFS2_INODE_INFO(inode);
c = JFFS2_SB_INFO(inode->i_sb);
jffs2_init_inode_info(f);
mutex_lock(&f->sem);
ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node);
if (ret)
goto error;
inode->i_mode = jemode_to_cpu(latest_node.mode);
i_uid_write(inode, je16_to_cpu(latest_node.uid));
i_gid_write(inode, je16_to_cpu(latest_node.gid));
inode->i_size = je32_to_cpu(latest_node.isize);
inode->i_atime = ITIME(je32_to_cpu(latest_node.atime));
inode->i_mtime = ITIME(je32_to_cpu(latest_node.mtime));
inode->i_ctime = ITIME(je32_to_cpu(latest_node.ctime));
set_nlink(inode, f->inocache->pino_nlink);
inode->i_blocks = (inode->i_size + 511) >> 9;
}}}
--
Ticket URL: <http://devel.rtems.org/ticket/4538#comment:2>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs