Skip to contentSkip to conversation

md-cluster: correct the num for comparison

PATCH Superseded Goldwyn Rodrigues 2 participants 3 messages Apr 14, 2015 – Apr 21, 2015 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 md-cluster: correct the num for comparison

Author: Guoqing Jiang <[email protected]>

Since the node num of md-cluster is from zero, and cinfo->slot_number represents the slot num of dlm, no need to check for equality.

---
 drivers/md/md-cluster.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md-cluster.c +1 -1
index 96679b2..6bdc45e 100644
@@ -612,7 +612,7 @@ static int join(struct mddev *mddev, int nodes)
 	if (ret)
 		goto err;
 	wait_for_completion(&cinfo->completion);
-	if (nodes <= cinfo->slot_number) {
+	if (nodes < cinfo->slot_number) {
 		pr_err("md-cluster: Slot allotted(%d) greater than available slots(%d)", cinfo->slot_number - 1,
 			nodes);
 		ret = -ERANGE;
Signature · 1 line
2.1.4
#1 lore raw
Quoted 17 lines · On Tue, 14 Apr 2015 10:42:32 -0500 Goldwyn Rodrigues <[email protected]> wrote:

Author: Guoqing Jiang <[email protected]>

Since the node num of md-cluster is from zero, and cinfo->slot_number represents the slot num of dlm, no need to check for equality.

---
 drivers/md/md-cluster.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md-cluster.c +0 -0
index 96679b2..6bdc45e 100644

drivers/md/md-cluster.c static int join(struct mddev *mddev, int nodes) · line 618

Quoted 8 lines
drivers/md/md-cluster.c +1 -1
@@ -612,7 +612,7 @@ static int join(struct mddev *mddev, int nodes)
 	if (ret)
 		goto err;
 	wait_for_completion(&cinfo->completion);
-	if (nodes <= cinfo->slot_number) {
+	if (nodes < cinfo->slot_number) {
 		pr_err("md-cluster: Slot allotted(%d) greater than available slots(%d)", cinfo->slot_number - 1,
 			nodes);
 		ret = -ERANGE;

I'll apply this, but it would be nice to fix the error message too. If 'nodes' is 3 and 'slot_number' is 4, then the message would be
md-cluster: Slot allotted(3) greater than available slots(3)
which looks weird.
(it should be "is greater", and there should be a "." at the end of the sentence).

NeilBrown

#2 lore raw

Hi Neil,

Quoted 26 lines · NeilBrown
Quoted 24 lines · On Tue, 14 Apr 2015 10:42:32 -0500 Goldwyn Rodrigues <[email protected]> wrote:

Author: Guoqing Jiang <[email protected]>

Since the node num of md-cluster is from zero, and cinfo->slot_number represents the slot num of dlm, no need to check for equality.

---
  drivers/md/md-cluster.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md-cluster.c +1 -1
index 96679b2..6bdc45e 100644
@@ -612,7 +612,7 @@ static int join(struct mddev *mddev, int nodes)
  	if (ret)
  		goto err;
  	wait_for_completion(&cinfo->completion);
-	if (nodes <= cinfo->slot_number) {
+	if (nodes < cinfo->slot_number) {
  		pr_err("md-cluster: Slot allotted(%d) greater than available slots(%d)", cinfo->slot_number - 1,
  			nodes);
Quoted 9 lines

drivers/md/md-cluster.c static int join(struct mddev *mddev, int nodes) · line 618

Quoted 1 line
drivers/md/md-cluster.c +0 -0
  		ret = -ERANGE;

I'll apply this, but it would be nice to fix the error message too. If 'nodes' is 3 and 'slot_number' is 4, then the message would be
md-cluster: Slot allotted(3) greater than available slots(3)
which looks weird.
(it should be "is greater", and there should be a "." at the end of the sentence).

Yes, I have corrected this and re-sent the patch.

Thanks,

Signature · 1 line
Goldwyn