Commit 39ec3774 authored by Gang He's avatar Gang He Committed by Linus Torvalds

ocfs2: add duplicated ino number check

Add duplicated ino number check, to avoid adding a file into the file
check list when this file is being checked.

Link: http://lkml.kernel.org/r/1495611866-27360-5-git-send-email-ghe@suse.comSigned-off-by: default avatarGang He <ghe@suse.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5f483c4a
...@@ -353,6 +353,22 @@ static ssize_t ocfs2_filecheck_attr_show(struct kobject *kobj, ...@@ -353,6 +353,22 @@ static ssize_t ocfs2_filecheck_attr_show(struct kobject *kobj,
return total; return total;
} }
static inline int
ocfs2_filecheck_is_dup_entry(struct ocfs2_filecheck_sysfs_entry *ent,
unsigned long ino)
{
struct ocfs2_filecheck_entry *p;
list_for_each_entry(p, &ent->fs_fcheck->fc_head, fe_list) {
if (!p->fe_done) {
if (p->fe_ino == ino)
return 1;
}
}
return 0;
}
static inline int static inline int
ocfs2_filecheck_erase_entry(struct ocfs2_filecheck_sysfs_entry *ent) ocfs2_filecheck_erase_entry(struct ocfs2_filecheck_sysfs_entry *ent)
{ {
...@@ -467,7 +483,10 @@ static ssize_t ocfs2_filecheck_attr_store(struct kobject *kobj, ...@@ -467,7 +483,10 @@ static ssize_t ocfs2_filecheck_attr_store(struct kobject *kobj,
} }
spin_lock(&ent->fs_fcheck->fc_lock); spin_lock(&ent->fs_fcheck->fc_lock);
if ((ent->fs_fcheck->fc_size >= ent->fs_fcheck->fc_max) && if (ocfs2_filecheck_is_dup_entry(ent, args.fa_ino)) {
ret = -EEXIST;
kfree(entry);
} else if ((ent->fs_fcheck->fc_size >= ent->fs_fcheck->fc_max) &&
(ent->fs_fcheck->fc_done == 0)) { (ent->fs_fcheck->fc_done == 0)) {
mlog(ML_NOTICE, mlog(ML_NOTICE,
"Cannot do more file check " "Cannot do more file check "
......
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