Patchwork [2/2] ext4: MMP: fix error message rate-limiting logic in kmmpd

login
register
mail settings
Submitter Nikitas Angelinas
Date Sept. 23, 2011, 12:23 a.m.
Message ID <1316737389-5522-3-git-send-email-nikitas_angelinas@xyratex.com>
Download mbox | patch
Permalink /patch/116022/
State Superseded
Headers show

Comments

Nikitas Angelinas - Sept. 23, 2011, 12:23 a.m.
Current logic would print an error message only once, and then
'failed_writes' would stay at 1. Rework the loop to increment
'failed_writes' and print the error message every s_mmp_update_interval
* 60 seconds, as intended according to the comment.

Perhaps it would be better to reset 'failed_writes' to 0 on every
successful write, such that new errors are noticed sooner, but maybe in
the interest of efficiency it would be best not to add an operation on
every kmmpd thread run?

Signed-off-by: Nikitas Angelinas <nikitas_angelinas@xyratex.com>
Signed-off-by: Andrew Perepechko <andrew_perepechko@xyratex.com>
---
 fs/ext4/mmp.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
Andreas Dilger - Sept. 23, 2011, 6:51 p.m.
On 2011-09-22, at 6:23 PM, Nikitas Angelinas wrote:
> Current logic would print an error message only once, and then
> 'failed_writes' would stay at 1. Rework the loop to increment
> 'failed_writes' and print the error message every s_mmp_update_interval
> * 60 seconds, as intended according to the comment.
> 
> Perhaps it would be better to reset 'failed_writes' to 0 on every
> successful write, such that new errors are noticed sooner, but maybe in
> the interest of efficiency it would be best not to add an operation on
> every kmmpd thread run?
> 
> Signed-off-by: Nikitas Angelinas <nikitas_angelinas@xyratex.com>
> Signed-off-by: Andrew Perepechko <andrew_perepechko@xyratex.com>

Acked-by: Andreas Dilger <adilger@dilger.ca>

Thanks for the fix.
> ---
> fs/ext4/mmp.c |    5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
> index 2fca64e..6b32742 100644
> --- a/fs/ext4/mmp.c
> +++ b/fs/ext4/mmp.c
> @@ -125,8 +125,9 @@ static int kmmpd(void *data)
> 		 * Don't spew too many error messages. Print one every
> 		 * (s_mmp_update_interval * 60) seconds.
> 		 */
> -		if (retval && (failed_writes % 60) == 0) {
> -			ext4_error(sb, "Error writing to MMP block");
> +		if (retval) {
> +			if ((failed_writes % 60) == 0)
> +				ext4_error(sb, "Error writing to MMP block");
> 			failed_writes++;
> 		}
> 
> -- 
> 1.7.4.4
> 


Cheers, Andreas





--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
index 2fca64e..6b32742 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -125,8 +125,9 @@  static int kmmpd(void *data)
 		 * Don't spew too many error messages. Print one every
 		 * (s_mmp_update_interval * 60) seconds.
 		 */
-		if (retval && (failed_writes % 60) == 0) {
-			ext4_error(sb, "Error writing to MMP block");
+		if (retval) {
+			if ((failed_writes % 60) == 0)
+				ext4_error(sb, "Error writing to MMP block");
 			failed_writes++;
 		}