From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: Re: [PATCH] oxenstored: fix short-write issue Date: Tue, 27 Oct 2015 18:21:09 +0100 Message-ID: <20151027172109.GO2483@var.bordeaux.inria.fr> References: <1445965809-5144-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Zr7vs-0003GF-7z for xen-devel@lists.xenproject.org; Tue, 27 Oct 2015 17:21:12 +0000 Content-Disposition: inline In-Reply-To: <1445965809-5144-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: Xen-devel , Ian Jackson , Ian Campbell , David Scott List-Id: xen-devel@lists.xenproject.org That being said, Wei Liu, le Tue 27 Oct 2015 17:10:09 +0000, a =E9crit : > @@ -91,10 +91,12 @@ let write_fd back con s len =3D > Unix.write back.fd s 0 len > = > let write_mmap back con s len =3D > - let ws =3D Xs_ring.write back.mmap s len in > - if ws > 0 then > + let ws =3D 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 :=3D !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 =3D > match con.backend with > -- = > 2.1.4 > = -- = Samuel un driver qui fait quoi, alors ? ben pour les bips pour passer les oops en morse -+- #ens-mim - vive les rapports de bug -+-