Skip to contentSkip to conversation

libceph: fix wrong opcode use in osd_req_encode_op()

PATCH In review Alex Elder 2 participants 2 messages Mar 3, 2013 – Mar 5, 2013 Ceph common code (libceph)

lore
Share & tools
lore

Alex Elder

author
#0 lore raw

PATCH 1/1 libceph: fix wrong opcode use in osd_req_encode_op()

The new cases added to osd_req_encode_op() caused a new sparse error, which highlighted an existing problem that had been overlooked since it was originally checked in. When an unsupported opcode is found the destination rather than the source opcode was being used in the error message. The two differ in their byte order, and we want to be using the one in the source.

Fix the problem in both spots.

---
 net/ceph/osd_client.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/ceph/osd_client.c +2 -2
Index: b/net/ceph/osd_client.c
===================================================================
@@ -258,7 +258,7 @@ static void osd_req_encode_op(struct cep
 		dst->watch.flag = src->watch.flag;
 		break;
 	default:
-		pr_err("unrecognized osd opcode %d\n", dst->op);
+		pr_err("unrecognized osd opcode %d\n", src->op);
 		WARN_ON(1);
 		break;
 	case CEPH_OSD_OP_MAPEXT:
@@ -316,7 +316,7 @@ static void osd_req_encode_op(struct cep
 	case CEPH_OSD_OP_PGLS:
 	case CEPH_OSD_OP_PGLS_FILTER:
 		pr_err("unsupported osd opcode %s\n",
-			ceph_osd_op_name(dst->op));
+			ceph_osd_op_name(src->op));
 		WARN_ON(1);
 		break;
 	}
Reviewed-by on v1 1/1
#1 lore raw
Quoted 37 lines · Alex Elder

The new cases added to osd_req_encode_op() caused a new sparse error, which highlighted an existing problem that had been overlooked since it was originally checked in. When an unsupported opcode is found the destination rather than the source opcode was being used in the error message. The two differ in their byte order, and we want to be using the one in the source.

Fix the problem in both spots.

---
  net/ceph/osd_client.c |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

Index: b/net/ceph/osd_client.c
===================================================================

net/ceph/osd_client.c +2 -2
@@ -258,7 +258,7 @@ static void osd_req_encode_op(struct cep
  		dst->watch.flag = src->watch.flag;
  		break;
  	default:
-		pr_err("unrecognized osd opcode %d\n", dst->op);
+		pr_err("unrecognized osd opcode %d\n", src->op);
  		WARN_ON(1);
  		break;
  	case CEPH_OSD_OP_MAPEXT:
@@ -316,7 +316,7 @@ static void osd_req_encode_op(struct cep
  	case CEPH_OSD_OP_PGLS:
  	case CEPH_OSD_OP_PGLS_FILTER:
  		pr_err("unsupported osd opcode %s\n",
-			ceph_osd_op_name(dst->op));
+			ceph_osd_op_name(src->op));
  		WARN_ON(1);
  		break;
  	}