Commit 8c5a0366 authored by Jean-Christophe DUBOIS's avatar Jean-Christophe DUBOIS Committed by David Woodhouse

jffs2: allow to complete xattr integrity check on first GC scan

Unlike file data integrity the xattr data integrity was not checked
before some explicit access to the attribute was made.

This could leave in the system a number of corrupted extended attributes
which will be detected only at access time and possibly at a very late
time compared to the time the corruption actually happened.

This patch adds the ability to check for extended attribute integrity
on first GC scan pass (similar to file data integrity check). This allows
for all present attributes to be completly verified before any use of them.

In order to work correctly this patch also needs the patch allowing
JFFS2 to discriminate between recoverable and non recoverable errors
on extended attributes.
Signed-off-by: default avatarJean-Christophe DUBOIS <jcd@tribudubois.net>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 9824f75d
...@@ -1421,6 +1421,7 @@ int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *i ...@@ -1421,6 +1421,7 @@ int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *i
mutex_unlock(&f->sem); mutex_unlock(&f->sem);
jffs2_do_clear_inode(c, f); jffs2_do_clear_inode(c, f);
} }
jffs2_xattr_do_crccheck_inode(c, ic);
kfree (f); kfree (f);
return ret; return ret;
} }
......
...@@ -437,6 +437,8 @@ static void unrefer_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datu ...@@ -437,6 +437,8 @@ static void unrefer_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datu
* is called to release xattr related objects when unmounting. * is called to release xattr related objects when unmounting.
* check_xattr_ref_inode(c, ic) * check_xattr_ref_inode(c, ic)
* is used to confirm inode does not have duplicate xattr name/value pair. * is used to confirm inode does not have duplicate xattr name/value pair.
* jffs2_xattr_do_crccheck_inode(c, ic)
* is used to force xattr data integrity check during the initial gc scan.
* -------------------------------------------------- */ * -------------------------------------------------- */
static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref) static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref)
{ {
...@@ -684,6 +686,11 @@ static int check_xattr_ref_inode(struct jffs2_sb_info *c, struct jffs2_inode_cac ...@@ -684,6 +686,11 @@ static int check_xattr_ref_inode(struct jffs2_sb_info *c, struct jffs2_inode_cac
return rc; return rc;
} }
void jffs2_xattr_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic)
{
check_xattr_ref_inode(c, ic);
}
/* -------- xattr subsystem functions --------------- /* -------- xattr subsystem functions ---------------
* jffs2_init_xattr_subsystem(c) * jffs2_init_xattr_subsystem(c)
* is used to initialize semaphore and list_head, and some variables. * is used to initialize semaphore and list_head, and some variables.
......
...@@ -77,6 +77,7 @@ extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c); ...@@ -77,6 +77,7 @@ extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c);
extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c, extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
uint32_t xid, uint32_t version); uint32_t xid, uint32_t version);
extern void jffs2_xattr_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
...@@ -108,6 +109,7 @@ extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t); ...@@ -108,6 +109,7 @@ extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t);
#define jffs2_build_xattr_subsystem(c) #define jffs2_build_xattr_subsystem(c)
#define jffs2_clear_xattr_subsystem(c) #define jffs2_clear_xattr_subsystem(c)
#define jffs2_xattr_do_crccheck_inode(c, ic)
#define jffs2_xattr_delete_inode(c, ic) #define jffs2_xattr_delete_inode(c, ic)
#define jffs2_xattr_free_inode(c, ic) #define jffs2_xattr_free_inode(c, ic)
#define jffs2_verify_xattr(c) (1) #define jffs2_verify_xattr(c) (1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment