[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] oxenstored: fix short-write issue



That being said,

Wei Liu, le Tue 27 Oct 2015 17:10:09 +0000, a écrit :
> @@ -91,10 +91,12 @@ let write_fd back con s len =
>       Unix.write back.fd s 0 len
>  
>  let write_mmap back con s len =
> -     let ws = Xs_ring.write back.mmap s len in
> -     if ws > 0 then
> +     let ws = ref (Xs_ring.write back.mmap s len) in
> +     if !ws < len then

This could also be

        if !ws > 0 && !ws < len then

And also perhaps add a comment:

        (* Xs_ring.write returned a short-write.  Perhaps it just hit
           the ring boundary and there is actually still room. Call it a
           second time to try to finish writing at the beginning of the
           ring. *)

> +             ws := !ws + Xs_ring.write back.mmap (String.sub s !ws (len - 
> !ws)) (len - !ws);
> +     if !ws > 0 then
>               back.eventchn_notify ();
> -     ws
> +     !ws
>  
>  let write con s len =
>       match con.backend with
> -- 
> 2.1.4
> 

-- 
Samuel
<N> un driver qui fait quoi, alors ?
<y> ben pour les bips
<s> pour passer les oops en morse
 -+- #ens-mim - vive les rapports de bug -+-

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.