[PATCH 5/5] libceph: activate message data assignment checks

2013-03-05 Thread Alex Elder
The mds client no longer tries to assign zero-length message data,
and the osd client no longer sets its data info more than once.
This allows us to activate assertions in the messenger to verify
these things never happen.

This resolves both of these:
http://tracker.ceph.com/issues/4263
http://tracker.ceph.com/issues/4284

Signed-off-by: Alex Elder el...@inktank.com
---
 net/ceph/messenger.c |   20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 97506ac..5bf1bb5 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2677,10 +2677,10 @@ EXPORT_SYMBOL(ceph_con_keepalive);
 void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages,
unsigned int page_count, size_t alignment)
 {
-   /* BUG_ON(!pages); */
-   /* BUG_ON(!page_count); */
-   /* BUG_ON(msg-pages); */
-   /* BUG_ON(msg-page_count); */
+   BUG_ON(!pages);
+   BUG_ON(!page_count);
+   BUG_ON(msg-pages);
+   BUG_ON(msg-page_count);

msg-pages = pages;
msg-page_count = page_count;
@@ -2691,8 +2691,8 @@ EXPORT_SYMBOL(ceph_msg_data_set_pages);
 void ceph_msg_data_set_pagelist(struct ceph_msg *msg,
struct ceph_pagelist *pagelist)
 {
-   /* BUG_ON(!pagelist); */
-   /* BUG_ON(msg-pagelist); */
+   BUG_ON(!pagelist);
+   BUG_ON(msg-pagelist);

msg-pagelist = pagelist;
 }
@@ -2700,8 +2700,8 @@ EXPORT_SYMBOL(ceph_msg_data_set_pagelist);

 void ceph_msg_data_set_bio(struct ceph_msg *msg, struct bio *bio)
 {
-   /* BUG_ON(!bio); */
-   /* BUG_ON(msg-bio); */
+   BUG_ON(!bio);
+   BUG_ON(msg-bio);

msg-bio = bio;
 }
@@ -2709,8 +2709,8 @@ EXPORT_SYMBOL(ceph_msg_data_set_bio);

 void ceph_msg_data_set_trail(struct ceph_msg *msg, struct ceph_pagelist
*trail)
 {
-   /* BUG_ON(!trail); */
-   /* BUG_ON(msg-trail); */
+   BUG_ON(!trail);
+   BUG_ON(msg-trail);

msg-trail = trail;
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe ceph-devel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] libceph: activate message data assignment checks

2013-03-05 Thread Greg Farnum
On Tuesday, March 5, 2013 at 5:53 AM, Alex Elder wrote:
 The mds client no longer tries to assign zero-length message data,
 and the osd client no longer sets its data info more than once.
 This allows us to activate assertions in the messenger to verify
 these things never happen.
 
 This resolves both of these:
 http://tracker.ceph.com/issues/4263
 http://tracker.ceph.com/issues/4284
 
 Signed-off-by: Alex Elder el...@inktank.com (mailto:el...@inktank.com)
 ---
 net/ceph/messenger.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)
 
 diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
 index 97506ac..5bf1bb5 100644
 --- a/net/ceph/messenger.c
 +++ b/net/ceph/messenger.c
 @@ -2677,10 +2677,10 @@ EXPORT_SYMBOL(ceph_con_keepalive);
 void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages,
 unsigned int page_count, size_t alignment)
 {
 - /* BUG_ON(!pages); */
 - /* BUG_ON(!page_count); */
 - /* BUG_ON(msg-pages); */
 - /* BUG_ON(msg-page_count); */
 + BUG_ON(!pages);
 + BUG_ON(!page_count);
 + BUG_ON(msg-pages);
 + BUG_ON(msg-page_count);
 
 msg-pages = pages;
 msg-page_count = page_count;
 @@ -2691,8 +2691,8 @@ EXPORT_SYMBOL(ceph_msg_data_set_pages);
 void ceph_msg_data_set_pagelist(struct ceph_msg *msg,
 struct ceph_pagelist *pagelist)
 {
 - /* BUG_ON(!pagelist); */
 - /* BUG_ON(msg-pagelist); */
 + BUG_ON(!pagelist);
 + BUG_ON(msg-pagelist);
 
 msg-pagelist = pagelist;
 }
 @@ -2700,8 +2700,8 @@ EXPORT_SYMBOL(ceph_msg_data_set_pagelist);
 
 void ceph_msg_data_set_bio(struct ceph_msg *msg, struct bio *bio)
 {
 - /* BUG_ON(!bio); */
 - /* BUG_ON(msg-bio); */
 + BUG_ON(!bio);
 + BUG_ON(msg-bio);
 
 msg-bio = bio;
 }
 @@ -2709,8 +2709,8 @@ EXPORT_SYMBOL(ceph_msg_data_set_bio);
 
 void ceph_msg_data_set_trail(struct ceph_msg *msg, struct ceph_pagelist
 *trail)
 {
 - /* BUG_ON(!trail); */
 - /* BUG_ON(msg-trail); */
 + BUG_ON(!trail);
 + BUG_ON(msg-trail);
 
 msg-trail = trail;
 }
 -- 
 1.7.9.5
 


Reviewed-by: Greg Farnum g...@inktank.com

I'll leave #4 for Josh to review. :)

Software Engineer #42 @ http://inktank.com | http://ceph.com
--
To unsubscribe from this list: send the line unsubscribe ceph-devel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html