ocfs2: fix some small problems
First, move setting fe_done = 1 in spin lock, avoid bring any potential race condition. Second, tune mlog message level from ERROR to NOTICE, since the message should not belong to error message. Third, tune errno to -EAGAIN when file check queue is full, this errno is more appropriate in the case. Link: http://lkml.kernel.org/r/1495611866-27360-3-git-send-email-ghe@suse.com Signed-off-by: Gang 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
@@ -283,7 +283,7 @@ ocfs2_filecheck_adjust_max(struct ocfs2_filecheck_sysfs_entry *ent,
|
|||||||
|
|
||||||
spin_lock(&ent->fs_fcheck->fc_lock);
|
spin_lock(&ent->fs_fcheck->fc_lock);
|
||||||
if (len < (ent->fs_fcheck->fc_size - ent->fs_fcheck->fc_done)) {
|
if (len < (ent->fs_fcheck->fc_size - ent->fs_fcheck->fc_done)) {
|
||||||
mlog(ML_ERROR,
|
mlog(ML_NOTICE,
|
||||||
"Cannot set online file check maximum entry number "
|
"Cannot set online file check maximum entry number "
|
||||||
"to %u due to too many pending entries(%u)\n",
|
"to %u due to too many pending entries(%u)\n",
|
||||||
len, ent->fs_fcheck->fc_size - ent->fs_fcheck->fc_done);
|
len, ent->fs_fcheck->fc_size - ent->fs_fcheck->fc_done);
|
||||||
@@ -457,8 +457,8 @@ static void
|
|||||||
ocfs2_filecheck_done_entry(struct ocfs2_filecheck_sysfs_entry *ent,
|
ocfs2_filecheck_done_entry(struct ocfs2_filecheck_sysfs_entry *ent,
|
||||||
struct ocfs2_filecheck_entry *entry)
|
struct ocfs2_filecheck_entry *entry)
|
||||||
{
|
{
|
||||||
entry->fe_done = 1;
|
|
||||||
spin_lock(&ent->fs_fcheck->fc_lock);
|
spin_lock(&ent->fs_fcheck->fc_lock);
|
||||||
|
entry->fe_done = 1;
|
||||||
ent->fs_fcheck->fc_done++;
|
ent->fs_fcheck->fc_done++;
|
||||||
spin_unlock(&ent->fs_fcheck->fc_lock);
|
spin_unlock(&ent->fs_fcheck->fc_lock);
|
||||||
}
|
}
|
||||||
@@ -540,11 +540,11 @@ static ssize_t ocfs2_filecheck_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 ((ent->fs_fcheck->fc_size >= ent->fs_fcheck->fc_max) &&
|
||||||
(ent->fs_fcheck->fc_done == 0)) {
|
(ent->fs_fcheck->fc_done == 0)) {
|
||||||
mlog(ML_ERROR,
|
mlog(ML_NOTICE,
|
||||||
"Cannot do more file check "
|
"Cannot do more file check "
|
||||||
"since file check queue(%u) is full now\n",
|
"since file check queue(%u) is full now\n",
|
||||||
ent->fs_fcheck->fc_max);
|
ent->fs_fcheck->fc_max);
|
||||||
ret = -EBUSY;
|
ret = -EAGAIN;
|
||||||
kfree(entry);
|
kfree(entry);
|
||||||
} else {
|
} else {
|
||||||
if ((ent->fs_fcheck->fc_size >= ent->fs_fcheck->fc_max) &&
|
if ((ent->fs_fcheck->fc_size >= ent->fs_fcheck->fc_max) &&
|
||||||
|
|||||||
Reference in New Issue
Block a user