diff mbox

[v2,2/4] ocfs2: fix some small problems

Message ID 1482308461-12964-3-git-send-email-ghe@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gang He Dec. 21, 2016, 8:20 a.m. UTC
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.

Signed-off-by: Gang He <ghe@suse.com>
---
 fs/ocfs2/filecheck.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Mark Fasheh Dec. 28, 2016, 10:34 p.m. UTC | #1
Hi Gang, one small comment below:

On Wed, Dec 21, 2016 at 2:20 AM, Gang He <ghe@suse.com> wrote:
> 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.
>
> Signed-off-by: Gang He <ghe@suse.com>
> ---
>  fs/ocfs2/filecheck.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> @@ -545,11 +545,11 @@ static ssize_t ocfs2_filecheck_store(struct kobject *kobj,
>         spin_lock(&ent->fs_fcheck->fc_lock);
>         if ((ent->fs_fcheck->fc_size >= ent->fs_fcheck->fc_max) &&
>             (ent->fs_fcheck->fc_done == 0)) {
> -               mlog(ML_ERROR,
> +               mlog(ML_NOTICE,
>                 "Cannot do more file check "
>                 "since file check queue(%u) is full now\n",
>                 ent->fs_fcheck->fc_max);
> -               ret = -EBUSY;
> +               ret = -EAGAIN;

This change wasn't described in the patch header. Granted, from the
message above the change, -EAGAIN certainly seems a more reasonable
return value but it would be good to know whether this was intended
and why.

Thanks,
   --Mark
Gang He Dec. 29, 2016, 2:54 a.m. UTC | #2
>>> 
> Hi Gang, one small comment below:
> 
> On Wed, Dec 21, 2016 at 2:20 AM, Gang He <ghe@suse.com> wrote:
>> 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.
>>
>> Signed-off-by: Gang He <ghe@suse.com>
>> ---
>>  fs/ocfs2/filecheck.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> @@ -545,11 +545,11 @@ static ssize_t ocfs2_filecheck_store(struct kobject 
> *kobj,
>>         spin_lock(&ent->fs_fcheck->fc_lock);
>>         if ((ent->fs_fcheck->fc_size >= ent->fs_fcheck->fc_max) &&
>>             (ent->fs_fcheck->fc_done == 0)) {
>> -               mlog(ML_ERROR,
>> +               mlog(ML_NOTICE,
>>                 "Cannot do more file check "
>>                 "since file check queue(%u) is full now\n",
>>                 ent->fs_fcheck->fc_max);
>> -               ret = -EBUSY;
>> +               ret = -EAGAIN;
> 
> This change wasn't described in the patch header. Granted, from the
> message above the change, -EAGAIN certainly seems a more reasonable
> return value but it would be good to know whether this was intended
> and why.
Hello Mark, thank for your comments, I will add the description for this change in V3.
Do you have any other comments for the other patches in v2?

Thanks
Gang

> 
> Thanks,
>    --Mark
diff mbox

Patch

diff --git a/fs/ocfs2/filecheck.c b/fs/ocfs2/filecheck.c
index cc7b595..4347727 100644
--- a/fs/ocfs2/filecheck.c
+++ b/fs/ocfs2/filecheck.c
@@ -288,7 +288,7 @@  int ocfs2_filecheck_remove_sysfs(struct super_block *sb)
 
 	spin_lock(&ent->fs_fcheck->fc_lock);
 	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 "
 		"to %u due to too many pending entries(%u)\n",
 		len, ent->fs_fcheck->fc_size - ent->fs_fcheck->fc_done);
@@ -462,8 +462,8 @@  static ssize_t ocfs2_filecheck_show(struct kobject *kobj,
 ocfs2_filecheck_done_entry(struct ocfs2_filecheck_sysfs_entry *ent,
 			   struct ocfs2_filecheck_entry *entry)
 {
-	entry->fe_done = 1;
 	spin_lock(&ent->fs_fcheck->fc_lock);
+	entry->fe_done = 1;
 	ent->fs_fcheck->fc_done++;
 	spin_unlock(&ent->fs_fcheck->fc_lock);
 }
@@ -545,11 +545,11 @@  static ssize_t ocfs2_filecheck_store(struct kobject *kobj,
 	spin_lock(&ent->fs_fcheck->fc_lock);
 	if ((ent->fs_fcheck->fc_size >= ent->fs_fcheck->fc_max) &&
 	    (ent->fs_fcheck->fc_done == 0)) {
-		mlog(ML_ERROR,
+		mlog(ML_NOTICE,
 		"Cannot do more file check "
 		"since file check queue(%u) is full now\n",
 		ent->fs_fcheck->fc_max);
-		ret = -EBUSY;
+		ret = -EAGAIN;
 		kfree(entry);
 	} else {
 		if ((ent->fs_fcheck->fc_size >= ent->fs_fcheck->fc_max) &&