<div dir="ltr">Reviewed-by: Robin Dong <<a href="mailto:sanbai@taobao.com">sanbai@taobao.com</a>></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/26 Liu Yuan <span dir="ltr"><<a href="mailto:namei.unix@gmail.com" target="_blank">namei.unix@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We should use get_vdi_copy_policy() to get the policy if req->rq.obj.policy == 0<br>
or we will panic the sheep daemon<br>
<br>
Signed-off-by: Liu Yuan <<a href="mailto:namei.unix@gmail.com">namei.unix@gmail.com</a>><br>
---<br>
sheep/gateway.c | 4 +++-<br>
1 file changed, 3 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/sheep/gateway.c b/sheep/gateway.c<br>
index c8a1e9d..f0f716a 100644<br>
--- a/sheep/gateway.c<br>
+++ b/sheep/gateway.c<br>
@@ -518,9 +518,11 @@ static int gateway_forward_request(struct request *req)<br>
*/<br>
nr_reqs = nr_to_send;<br>
if (nr_to_send > nr_copies) {<br>
+ uint8_t policy = req->rq.obj.copy_policy ?:<br>
+ get_vdi_copy_policy(oid_to_vid(req->rq.obj.oid));<br>
int ds;<br>
/* Only for erasure code, nr_to_send might > nr_copies */<br>
- ec_policy_to_dp(req->rq.obj.copy_policy, &ds, NULL);<br>
+ ec_policy_to_dp(policy, &ds, NULL);<br>
if (nr_copies < ds) {<br>
sd_err("There isn't enough copies(%d) to send out (%d)",<br>
nr_copies, nr_to_send);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.2<br>
<br>
--<br>
sheepdog mailing list<br>
<a href="mailto:sheepdog@lists.wpkg.org">sheepdog@lists.wpkg.org</a><br>
<a href="http://lists.wpkg.org/mailman/listinfo/sheepdog" target="_blank">http://lists.wpkg.org/mailman/listinfo/sheepdog</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>--<br>Best Regard<br>Robin Dong
</div>