[rtems commit] cpukit/jffs2: Correctly init jffs2_inode_info
Joel Sherrill
joel at rtems.org
Thu Oct 12 23:30:55 UTC 2023
Module: rtems
Branch: master
Commit: 0a1d0dce3b2f84f7992828f3435ee3f292e79ad9
Changeset: http://git.rtems.org/rtems/commit/?id=0a1d0dce3b2f84f7992828f3435ee3f292e79ad9
Author: Kinsey Moore <kinsey.moore at oarcorp.com>
Date: Wed Oct 4 21:41:37 2023 -0500
cpukit/jffs2: Correctly init jffs2_inode_info
The repeated reinitialization of jffs2_inode_info must be done by the
members of the struct to avoid altering others.
---
cpukit/libfs/src/jffs2/src/fs-rtems.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/cpukit/libfs/src/jffs2/src/fs-rtems.c b/cpukit/libfs/src/jffs2/src/fs-rtems.c
index 0d97e7a6fb..8e8dfe8b0c 100644
--- a/cpukit/libfs/src/jffs2/src/fs-rtems.c
+++ b/cpukit/libfs/src/jffs2/src/fs-rtems.c
@@ -1523,6 +1523,8 @@ static struct _inode *new_inode(struct super_block *sb)
inode->i_cache_next = NULL; // Newest inode, about to be cached
+ mutex_init(&JFFS2_INODE_INFO(inode)->sem)
+
// Add to the icache
for (cached_inode = sb->s_root; cached_inode != NULL;
cached_inode = cached_inode->i_cache_next) {
@@ -1639,8 +1641,14 @@ void jffs2_iput(struct _inode *i)
static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
{
- memset(f, 0, sizeof(*f));
- mutex_init(&f->sem);
+ /* These must be set manually to preserve other members */
+ f->highest_version = 0;
+ f->fragtree = RB_ROOT;
+ f->metadata = NULL;
+ f->dents = NULL;
+ f->target = NULL;
+ f->flags = 0;
+ f->usercompr = 0;
}
static void jffs2_clear_inode (struct _inode *inode)
More information about the vc
mailing list