From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWijL-00037l-0J for qemu-devel@nongnu.org; Tue, 01 Sep 2015 06:23:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWijH-0008PX-3f for qemu-devel@nongnu.org; Tue, 01 Sep 2015 06:23:55 -0400 Received: from mail-ig0-x231.google.com ([2607:f8b0:4001:c05::231]:35330) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWijG-0008PR-Um for qemu-devel@nongnu.org; Tue, 01 Sep 2015 06:23:51 -0400 Received: by igbut12 with SMTP id ut12so46812381igb.0 for ; Tue, 01 Sep 2015 03:23:50 -0700 (PDT) Date: Tue, 1 Sep 2015 18:23:42 +0800 From: Liu Yuan Message-ID: <20150901102342.GD11585@ubuntu-trusty> References: <1441070971-22535-1-git-send-email-namei.unix@gmail.com> <20150901015100.GI31272@localhost.localdomain> <20150901020538.GB11585@ubuntu-trusty> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150901020538.GB11585@ubuntu-trusty> Subject: Re: [Qemu-devel] [PATCH] sheepdog: discard the payload if the header is invalid List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: Kevin Wolf , sheepdog-ng@googlegroups.com, Stefan Hajnoczi , qemu-devel@nongnu.org On Tue, Sep 01, 2015 at 10:05:38AM +0800, Liu Yuan wrote: > On Mon, Aug 31, 2015 at 09:51:00PM -0400, Jeff Cody wrote: > > On Tue, Sep 01, 2015 at 09:29:31AM +0800, Liu Yuan wrote: > > > From: Liu Yuan > > > > > > We need to discard the payload if we get a invalid header due to whatever reason > > > to avoid data stream curruption. > > > > If the header is invalid / corrupted, how can rsp.data_length be > > trusted? Out of curiosity, is this an issue you are seeing occur "in > > the wild"? For a second thought, we might not need this patch for the upstream because of auto-connection feature, which close the socket to bury the whole buffer. But old QEMU without auto-reconnection, might need this patch to drain the buffer. Thanks, Yuan > > This is the defensive patch. Header is invalid in the sense that only rsp.id is > invalid due to sheepdog driver bugs, for e.g., the request was misplaced after > being sent or duplicated requests sending to sheep daemon and get the duplicated > responses for the same request. > > Actually in the late 2012 we had seen this problem but we didn't find the root > cause how this happened by looking at the code statically and the problem was > gone silently while we restructured the code. > > But yesterday some centos6 users reported to me the problem of > 'cannot find aio_req' and hang the guest disk. That QEMU's sheepdog driver was > rather old and would bump rsp.id mismatch problem as we did in the late 2012. > By looking at the code again, I found this error handling problem. However, > this patch is not aimed to solve the rsp.id mismatch problem (If it still exist) > but just a defensive one after this problem happens. > > Thanks, > Yuan