From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxMaH-00074m-A1 for qemu-devel@nongnu.org; Fri, 03 Aug 2012 14:26:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxMaF-0002Q3-PT for qemu-devel@nongnu.org; Fri, 03 Aug 2012 14:26:49 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:59851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxMaF-0002Nq-44 for qemu-devel@nongnu.org; Fri, 03 Aug 2012 14:26:47 -0400 Received: by obbta14 with SMTP id ta14so1379177obb.4 for ; Fri, 03 Aug 2012 11:26:46 -0700 (PDT) Sender: fluxion Date: Fri, 3 Aug 2012 13:26:27 -0500 From: Michael Roth Message-ID: <20120803182627.GC16157@illuin> References: <1343869374-23417-1-git-send-email-lcapitulino@redhat.com> <1343869374-23417-18-git-send-email-lcapitulino@redhat.com> <20120802165411.GA16157@illuin> <20120802140848.7a2f826d@doriath.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120802140848.7a2f826d@doriath.home> Subject: Re: [Qemu-devel] [PATCH 17/34] qerror: drop QERR_SOCKET_CONNECT_IN_PROGRESS List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: kwolf@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com, eblake@redhat.com On Thu, Aug 02, 2012 at 02:08:48PM -0300, Luiz Capitulino wrote: > On Thu, 2 Aug 2012 11:54:11 -0500 > Michael Roth wrote: > > > On Wed, Aug 01, 2012 at 10:02:37PM -0300, Luiz Capitulino wrote: > > > This error is currently returned by inet_connect_opts(), however > > > it causes the follow spurious message on HMP: > > > > > > (qemu) migrate tcp:0:4444 > > > migrate: Connection can not be completed immediately > > > (qemu) > > > > > > But migration succeeds. > > > > I think the core issue is that inet_connect_opts() passes back the > > QERR_SOCKET_CONNECT_IN_PROGRESS via Error (which is fine), but that > > we have users that erroneous pass this error up the stack, when really, > > when specifying blocking=on as one of the options, they should be > > expecting and doing specific handling for this error. > > You're right here. > > > So if we fix that (by simply using a local Error when doing the call and > > using error_propagate() for non QSCIP errors), I think we can basically > > drop patches 14-17 by fixing the callers in that manner and just giving QSCIP > > it's own error class. > > I don't think QSCIP errors is something we should report to QMP clients, at > least not for the use-case this patch is about, hence we should not have > a specific error class for this. But we do have internal users besides QMP, and in this case they're interested in a specific error. What if we generalized it to EAGAIN or something? It's seems to me a fairly reasonable exception since it's one of the few errno-style errors that we don't generally propagate up the stack and need to check for explicitly... > > As pointed out by Markus in his review, keeping the in_progress flag introduced > by patch 14/34 should be enough to drop patches 15 and 16. Although, being an exceptional case I guess having an "in_progress" field to functions would use it is reasonable... I think I'd still prefer a class for QSCIP/EAGAIN that we could use for socket utility functions, but I'm okay with an in_progress param. > > > Relying on the errno result was something these socket errors were > > specifically meant to fix, since errno is set multiple times > > throughout the function and extracting an errno reliably requires > > callers to examine all the possible error paths and errno setters. So I > > think it's a regression to go back to the old behavior, and these were > > issues found in inet_connect() when we attempted to generalize it's > > usage for non-blocking connections. > > I'm not completely sure I agree because the new error format doesn't allow > callers to programatically know the cause of an failure. That's what errno Is error_get_class() not to be used for this purpose? It seems like a good thing to allow for in the odd circumstances where we do end up adding new error classes (unless the notion of error classes is purely legacy support for ones that libvirt is dependent on, and new ones will never be added?) > callers to programatically know the cause of an failure. That's what errno > is for, though. But it's just simply unusable when calling into a function that has multiple paths that can set it (or clobber it). Errno values frequently require the context of the function that set it to do anything intelligent, which is why QSCIP was added to remove that burden from users of inet_connect_opts() and friends. It's good that errors are no longer tethered to the errors descriptions/parameters and that that has amounted to a big reduction in the number of error classes we have, but that doesn't mean we shouldn't be open to added new error classes in the future, where it makes sense. But, again, an in_progress param seems like a workable compromise here, I just think prefering this approach over new error classes may lead to unecessary code churn in the future. > > But I'll drop the patch that changes inet_connect() to return errno, > so it's not worth it to discuss this specific case. >