#4535 closed defect (invalid)
acess JFFS2 sb->s_root question
Reported by: | chenjin_zhong | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 5.1 |
Component: | fs/jffs2 | Version: | 5 |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: |
Description
Hi, I have found when access global structure without mutex or spinlock about JFFS2. The code in RTEMS5.1 are listed as follows:
fs-rtems.c:
1) Add to the icache
for (cached_inode = sb->s_root; cached_inode != NULL;
cached_inode = cached_inode->i_cache_next) {
if (cached_inode->i_cache_next == NULL) {
cached_inode->i_cache_next = inode; Current last in cache points to newcomer
inode->i_cache_prev = cached_inode; Newcomer points back to last
break;
}
}
2) Check for this inode in the cache
for (inode = sb->s_root; inode != NULL; inode = inode->i_cache_next) {
if (inode->i_ino == ino) {
inode->i_count++;
break;
}
}
when multi-tasks or threads access sb->s_root simultaneously, The behavior is unknown.
Change History (2)
comment:1 Changed on 10/28/21 at 05:19:18 by Sebastian Huber
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed on 10/28/21 at 05:21:11 by Sebastian Huber
Component: | admin → fs/jaffs2 |
---|
Thanks for your interest in the RTEMS port of JFFS2. If you have questions, then you could also ask them on the devel@… mailing list. The RTEMS port of JFFS2 does not use a file system internal locking. There is a global lock for each JFFS2 instance: