Skip to contentSkip to conversation

write-back: fix break condition

PATCH In review Federico Cuello 5 participants 6 messages Feb 7, 2009 – Feb 10, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 write-back: fix break condition

Commit 673353723e7a6550625fb719059c5f31cfaecd18 fixed nr_to_write counter, but didn't set the break condition properly.

If nr_to_write == 0 after being decremented it will loop one more time before setting done = 1 and breaking the loop.

---
 mm/page-writeback.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)
mm/page-writeback.c +14 -13
index bb5fa2b..9e2ae50 100644
@@ -981,20 +981,21 @@ continue_unlock:
 				}
  			}
 
-			if (nr_to_write > 0)
+			if (nr_to_write > 0) {
 				nr_to_write--;
-			else if (wbc->sync_mode == WB_SYNC_NONE) {
-				/*
-				 * We stop writing back only if we are not
-				 * doing integrity sync. In case of integrity
-				 * sync we have to keep going because someone
-				 * may be concurrently dirtying pages, and we
-				 * might have synced a lot of newly appeared
-				 * dirty pages, but have not synced all of the
-				 * old dirty pages.
-				 */
-				done = 1;
-				break;
+				if (nr_to_write == 0 && wbc->sync_mode == WB_SYNC_NONE) {
+					/*
+					 * We stop writing back only if we are not
+					 * doing integrity sync. In case of integrity
+					 * sync we have to keep going because someone
+					 * may be concurrently dirtying pages, and we
+					 * might have synced a lot of newly appeared
+					 * dirty pages, but have not synced all of the
+					 * old dirty pages.
+					 */
+					done = 1;
+					break;
+				}
 			}
 
 			if (wbc->nonblocking && bdi_write_congested(bdi)) {
Signature · 1 line
1.6.1.2
maintainer
#1 lore raw

Thanks, but please do cc the people who were involved with a patch when you find a problem with it!

Quoted 2 lines · On Sat, 7 Feb 2009 01:33:30 -0200 Federico Cuello <[email protected]> wrote:

Commit 673353723e7a6550625fb719059c5f31cfaecd18 fixed nr_to_write counter, but didn't set the break condition properly.

It's actually commit dcf6a79dda5cc2a2bec183e50d829030c0972aaa ("write-back: fix nr_to_write counter").

Quoted 2 lines

If nr_to_write == 0 after being decremented it will loop one more time before setting done = 1 and breaking the loop.

We prefer that patches include the author's Signed-off-by:, as per Documentation/SubmittingPatches, please.

Quoted 30 lines
mm/page-writeback.c +7 -13
index bb5fa2b..9e2ae50 100644
@@ -981,20 +981,21 @@ continue_unlock:
 				}
  			}
 
-			if (nr_to_write > 0)
+			if (nr_to_write > 0) {
 				nr_to_write--;
-			else if (wbc->sync_mode == WB_SYNC_NONE) {
-				/*
-				 * We stop writing back only if we are not
-				 * doing integrity sync. In case of integrity
-				 * sync we have to keep going because someone
-				 * may be concurrently dirtying pages, and we
-				 * might have synced a lot of newly appeared
-				 * dirty pages, but have not synced all of the
-				 * old dirty pages.
-				 */
-				done = 1;
-				break;
+				if (nr_to_write == 0 && wbc->sync_mode == WB_SYNC_NONE) {
+					/*
+					 * We stop writing back only if we are not
+					 * doing integrity sync. In case of integrity
+					 * sync we have to keep going because someone
+					 * may be concurrently dirtying pages, and we

mm/page-writeback.c continue_unlock: · line 1001

Quoted 10 lines
mm/page-writeback.c +7 -0
+					 * might have synced a lot of newly appeared
+					 * dirty pages, but have not synced all of the
+					 * old dirty pages.
+					 */
+					done = 1;
+					break;
+				}
 			}
 
 			if (wbc->nonblocking && bdi_write_congested(bdi)) {

Artem, Nick, please check?

Acked-by
#2 lore raw
Quoted 58 lines · Andrew Morton

Thanks, but please do cc the people who were involved with a patch when you find a problem with it!

Quoted 2 lines · On Sat, 7 Feb 2009 01:33:30 -0200 Federico Cuello <[email protected]> wrote:

Commit 673353723e7a6550625fb719059c5f31cfaecd18 fixed nr_to_write counter, but didn't set the break condition properly.

It's actually commit dcf6a79dda5cc2a2bec183e50d829030c0972aaa ("write-back: fix nr_to_write counter").

Quoted 2 lines

If nr_to_write == 0 after being decremented it will loop one more time before setting done = 1 and breaking the loop.

We prefer that patches include the author's Signed-off-by:, as per Documentation/SubmittingPatches, please.

Quoted 39 lines
mm/page-writeback.c +14 -13
index bb5fa2b..9e2ae50 100644
@@ -981,20 +981,21 @@ continue_unlock:
 				}
  			}
 
-			if (nr_to_write > 0)
+			if (nr_to_write > 0) {
 				nr_to_write--;
-			else if (wbc->sync_mode == WB_SYNC_NONE) {
-				/*
-				 * We stop writing back only if we are not
-				 * doing integrity sync. In case of integrity
-				 * sync we have to keep going because someone
-				 * may be concurrently dirtying pages, and we
-				 * might have synced a lot of newly appeared
-				 * dirty pages, but have not synced all of the
-				 * old dirty pages.
-				 */
-				done = 1;
-				break;
+				if (nr_to_write == 0 && wbc->sync_mode == WB_SYNC_NONE) {
+					/*
+					 * We stop writing back only if we are not
+					 * doing integrity sync. In case of integrity
+					 * sync we have to keep going because someone
+					 * may be concurrently dirtying pages, and we
+					 * might have synced a lot of newly appeared
+					 * dirty pages, but have not synced all of the
+					 * old dirty pages.
+					 */
+					done = 1;
+					break;
+				}
 			}
 
Quoted 3 lines

mm/page-writeback.c continue_unlock: · line 1001

Quoted 1 line
mm/page-writeback.c +0 -0
 			if (wbc->nonblocking && bdi_write_congested(bdi)) {

Artem, Nick, please check?

Yes, this looks OK by me.

#3 lore raw
Quoted 59 lines · Nick Piggin
Quoted 56 lines · Andrew Morton

Thanks, but please do cc the people who were involved with a patch when you find a problem with it!

Quoted 2 lines · On Sat, 7 Feb 2009 01:33:30 -0200 Federico Cuello <[email protected]> wrote:

Commit 673353723e7a6550625fb719059c5f31cfaecd18 fixed nr_to_write counter, but didn't set the break condition properly.

It's actually commit dcf6a79dda5cc2a2bec183e50d829030c0972aaa ("write-back: fix nr_to_write counter").

Quoted 2 lines

If nr_to_write == 0 after being decremented it will loop one more time before setting done = 1 and breaking the loop.

We prefer that patches include the author's Signed-off-by:, as per Documentation/SubmittingPatches, please.

Quoted 37 lines
mm/page-writeback.c +14 -13
index bb5fa2b..9e2ae50 100644
@@ -981,20 +981,21 @@ continue_unlock:
 				}
  			}
 
-			if (nr_to_write > 0)
+			if (nr_to_write > 0) {
 				nr_to_write--;
-			else if (wbc->sync_mode == WB_SYNC_NONE) {
-				/*
-				 * We stop writing back only if we are not
-				 * doing integrity sync. In case of integrity
-				 * sync we have to keep going because someone
-				 * may be concurrently dirtying pages, and we
-				 * might have synced a lot of newly appeared
-				 * dirty pages, but have not synced all of the
-				 * old dirty pages.
-				 */
-				done = 1;
-				break;
+				if (nr_to_write == 0 && wbc->sync_mode == WB_SYNC_NONE) {
+					/*
+					 * We stop writing back only if we are not
+					 * doing integrity sync. In case of integrity
+					 * sync we have to keep going because someone
+					 * may be concurrently dirtying pages, and we
+					 * might have synced a lot of newly appeared
+					 * dirty pages, but have not synced all of the
+					 * old dirty pages.
+					 */
+					done = 1;
+					break;
+				}
 			}
Quoted 7 lines
Quoted 3 lines

mm/page-writeback.c continue_unlock: · line 1001

Quoted 1 line
mm/page-writeback.c +0 -0
 			if (wbc->nonblocking && bdi_write_congested(bdi)) {

Artem, Nick, please check?

Yes, this looks OK by me.

Shouldn't this go to stable 2.6.28, too ? They have not been in Cc for now. I think the problem was at first detected in 2.6.28.X, but it is not yet sure if it is solved or if this interacts with some ext4 problems.

Signature · 1 line
Damien Wyart
#4 lore raw
Quoted 10 lines · Damien Wyart
Quoted 5 lines
Quoted 1 line

Artem, Nick, please check?

Yes, this looks OK by me.

Shouldn't this go to stable 2.6.28, too ? They have not been in Cc for now. I think the problem was at first detected in 2.6.28.X, but it is not yet sure if it is solved or if this interacts with some ext4 problems.

It seems like this and my previous patch should go together to 2.6.28.X.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
#5 lore raw
In reply to Andrew Morton
Quoted 31 lines · Andrew Morton
Quoted 31 lines
mm/page-writeback.c +14 -13
-                     if (nr_to_write > 0)
+                     if (nr_to_write > 0) {
                              nr_to_write--;
-                     else if (wbc->sync_mode == WB_SYNC_NONE) {
-                             /*
-                              * We stop writing back only if we are not
-                              * doing integrity sync. In case of integrity
-                              * sync we have to keep going because someone
-                              * may be concurrently dirtying pages, and we
-                              * might have synced a lot of newly appeared
-                              * dirty pages, but have not synced all of the
-                              * old dirty pages.
-                              */
-                             done = 1;
-                             break;
+                             if (nr_to_write == 0 && wbc->sync_mode == WB_SYNC_NONE) {
+                                     /*
+                                      * We stop writing back only if we are not
+                                      * doing integrity sync. In case of integrity
+                                      * sync we have to keep going because someone
+                                      * may be concurrently dirtying pages, and we
+                                      * might have synced a lot of newly appeared
+                                      * dirty pages, but have not synced all of the
+                                      * old dirty pages.
+                                      */
+                                     done = 1;
+                                     break;
+                             }
                      }
Quoted 3 lines
Quoted 1 line
                      if (wbc->nonblocking && bdi_write_congested(bdi)) {

Artem, Nick, please check?

I have not tested it, but it looks OK to me.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)