Skip to contentSkip to conversation

GFS2: Fix infinite loop in rbm_find

PATCH New Bob Peterson 2 participants 2 messages Sep 12, 2012 1 message not in the archive GFS2 file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 GFS2: Fix infinite loop in rbm_find

Hi,

This patch fixes an infinite loop in gfs2_rbm_find that was introduced by the previous patch. The problem occurred when the length was less than 3 but the rbm block was byte-aligned, causing it to improperly return a extent length of zero, which caused it to spin.

Regards,

Bob Peterson
Red Hat File Systems

---
 fs/gfs2/rgrp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/gfs2/rgrp.c +1 -0
index b933cdc..3cc402c 100644
@@ -329,6 +329,7 @@ static u32 gfs2_free_extlen(const struct gfs2_rbm *rrbm, u32 len)
 	    gfs2_unaligned_extlen(&rbm, 4 - n_unaligned, &len))
 		goto out;
 
+	n_unaligned = len & 3;
 	/* Start is now byte aligned */
 	while (len > 3) {
 		start = rbm.bi->bi_bh->b_data;
#2 lore raw

PATCH 1/1 GFS2: Fix infinite loop in rbm_find

Hi,

Now in the -nmw git tree. Thanks,

Steve.

Quoted 30 lines · Bob Peterson

Hi,

This patch fixes an infinite loop in gfs2_rbm_find that was introduced by the previous patch. The problem occurred when the length was less than 3 but the rbm block was byte-aligned, causing it to improperly return a extent length of zero, which caused it to spin.

Regards,

Bob Peterson
Red Hat File Systems

---
 fs/gfs2/rgrp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/gfs2/rgrp.c +1 -0
index b933cdc..3cc402c 100644
@@ -329,6 +329,7 @@ static u32 gfs2_free_extlen(const struct gfs2_rbm *rrbm, u32 len)
 	    gfs2_unaligned_extlen(&rbm, 4 - n_unaligned, &len))
 		goto out;
 
+	n_unaligned = len & 3;
 	/* Start is now byte aligned */
 	while (len > 3) {
 		start = rbm.bi->bi_bh->b_data;