aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2007-07-11 16:55:23 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2007-08-14 05:32:04 -0400
commitbdcb88562ca90e6cfac13130e147c63aaa4f9e41 (patch)
tree54411e375cfd212e641ec464855f7da14e60cf4a
parent3650925893469ccb03dbcc6a440c5d363350f591 (diff)
[GFS2] soft lockup detected in databuf_lo_before_commit
This is part 2 of the patch for bug #245832, part 1 of which is already in the git tree. The problem was that sdp->sd_log_num_databuf was not always being protected by the gfs2_log_lock spinlock, but the sd_log_le_databuf (which it is supposed to reflect) was protected. That meant there was a timing window during which gfs2_log_flush called databuf_lo_before_commit and the count didn't match what was really on the linked list in that window. So when it ran out of items on the linked list, it decremented total_dbuf from 0 to -1 and thus never left the "while(total_dbuf)" loop. The solution is to protect the variable sdp->sd_log_num_databuf so that the value will always match the contents of the linked list, and therefore the number will never go negative, and therefore, the loop will be exited properly. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/gfs2/lops.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index aff70f0698fd..3b395c41b2f3 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -486,8 +486,8 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
486 gfs2_pin(sdp, bd->bd_bh); 486 gfs2_pin(sdp, bd->bd_bh);
487 tr->tr_num_databuf_new++; 487 tr->tr_num_databuf_new++;
488 } 488 }
489 sdp->sd_log_num_databuf++;
490 gfs2_log_lock(sdp); 489 gfs2_log_lock(sdp);
490 sdp->sd_log_num_databuf++;
491 list_add(&le->le_list, &sdp->sd_log_le_databuf); 491 list_add(&le->le_list, &sdp->sd_log_le_databuf);
492 gfs2_log_unlock(sdp); 492 gfs2_log_unlock(sdp);
493} 493}
@@ -523,7 +523,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
523 struct buffer_head *bh = NULL,*bh1 = NULL; 523 struct buffer_head *bh = NULL,*bh1 = NULL;
524 struct gfs2_log_descriptor *ld; 524 struct gfs2_log_descriptor *ld;
525 unsigned int limit; 525 unsigned int limit;
526 unsigned int total_dbuf = sdp->sd_log_num_databuf; 526 unsigned int total_dbuf;
527 unsigned int total_jdata = sdp->sd_log_num_jdata; 527 unsigned int total_jdata = sdp->sd_log_num_jdata;
528 unsigned int num, n; 528 unsigned int num, n;
529 __be64 *ptr = NULL; 529 __be64 *ptr = NULL;
@@ -535,6 +535,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
535 * into the log along with a header 535 * into the log along with a header
536 */ 536 */
537 gfs2_log_lock(sdp); 537 gfs2_log_lock(sdp);
538 total_dbuf = sdp->sd_log_num_databuf;
538 bd2 = bd1 = list_prepare_entry(bd1, &sdp->sd_log_le_databuf, 539 bd2 = bd1 = list_prepare_entry(bd1, &sdp->sd_log_le_databuf,
539 bd_le.le_list); 540 bd_le.le_list);
540 while(total_dbuf) { 541 while(total_dbuf) {
@@ -653,6 +654,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
653 break; 654 break;
654 } 655 }
655 bh = NULL; 656 bh = NULL;
657 BUG_ON(total_dbuf < num);
656 total_dbuf -= num; 658 total_dbuf -= num;
657 total_jdata -= num; 659 total_jdata -= num;
658 } 660 }