All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gang He <ghe@suse.com>
To: mfasheh@versity.com, jlbec@evilplan.org
Cc: Gang He <ghe@suse.com>,
	linux-kernel@vger.kernel.org, ocfs2-devel@oss.oracle.com,
	akpm@linux-foundation.org
Subject: [PATCH v3 2/4] ocfs2: fix some small problems
Date: Wed, 24 May 2017 15:44:24 +0800	[thread overview]
Message-ID: <1495611866-27360-3-git-send-email-ghe@suse.com> (raw)
In-Reply-To: <1495611866-27360-1-git-send-email-ghe@suse.com>

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.

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

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) &&
-- 
1.8.5.6

WARNING: multiple messages have this Message-ID (diff)
From: Gang He <ghe@suse.com>
To: mfasheh@versity.com, jlbec@evilplan.org
Cc: Gang He <ghe@suse.com>,
	linux-kernel@vger.kernel.org, ocfs2-devel@oss.oracle.com,
	akpm@linux-foundation.org
Subject: [Ocfs2-devel] [PATCH v3 2/4] ocfs2: fix some small problems
Date: Wed, 24 May 2017 15:44:24 +0800	[thread overview]
Message-ID: <1495611866-27360-3-git-send-email-ghe@suse.com> (raw)
In-Reply-To: <1495611866-27360-1-git-send-email-ghe@suse.com>

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.

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

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) &&
-- 
1.8.5.6

  parent reply	other threads:[~2017-05-24  7:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24  7:44 [PATCH v3 0/4] ocfs2: use kobject for online file check Gang He
2017-05-24  7:44 ` [Ocfs2-devel] " Gang He
2017-05-24  7:44 ` [PATCH v3 1/4] ocfs2: move some definitions to header file Gang He
2017-05-24  7:44   ` [Ocfs2-devel] " Gang He
2017-05-24  7:44 ` Gang He [this message]
2017-05-24  7:44   ` [Ocfs2-devel] [PATCH v3 2/4] ocfs2: fix some small problems Gang He
2017-05-24  7:44 ` [PATCH v3 3/4] ocfs2: add kobject for online file check Gang He
2017-05-24  7:44   ` [Ocfs2-devel] " Gang He
2017-05-24  7:44 ` [PATCH v3 4/4] ocfs2: add duplicative ino number check Gang He
2017-05-24  7:44   ` [Ocfs2-devel] " Gang He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495611866-27360-3-git-send-email-ghe@suse.com \
    --to=ghe@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfasheh@versity.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.