From patchwork Wed Sep 6 22:12:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 810817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xndBT1Rlzz9rxm for ; Thu, 7 Sep 2017 08:13:04 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 62F8AB88; Wed, 6 Sep 2017 22:13:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id E42ABB77 for ; Wed, 6 Sep 2017 22:12:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 70113483 for ; Wed, 6 Sep 2017 22:12:59 +0000 (UTC) X-Originating-IP: 208.91.1.34 Received: from carno.eng.vmware.com (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 76DC317209C for ; Thu, 7 Sep 2017 00:12:57 +0200 (CEST) From: Joe Stringer To: dev@openvswitch.org Date: Wed, 6 Sep 2017 15:12:52 -0700 Message-Id: <20170906221252.17257-1-joe@ovn.org> X-Mailer: git-send-email 2.14.1 X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] ofproto-dpif-upcall: Transition ukey on dp_ops error. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org In most situations, we don't expect that a flow we've successfully dumped, which we intend to delete, cannot be deleted. However, to make this code more resilient to ensure that ukeys *will* transition in all cases (including an error at this stage), grab the lock and transition this ukey forward to the evicted state, effectively treating a failure to delete as "this flow is already gone". If we subsequently find out that it wasn't deleted, then that's ok - we will re-dump, and validate at that stage, which should lead to creating a new ukey or deleting the datapath flow when that happens. Signed-off-by: Joe Stringer Reviewed-by: Greg Rose --- ofproto/ofproto-dpif-upcall.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 4a71bbe258df..bd324fbb6323 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -2227,6 +2227,11 @@ push_dp_ops(struct udpif *udpif, struct ukey_op *ops, size_t n_ops) if (op->dop.error) { /* flow_del error, 'stats' is unusable. */ + if (op->ukey) { + ovs_mutex_lock(&op->ukey->mutex); + transition_ukey(op->ukey, UKEY_EVICTED); + ovs_mutex_unlock(&op->ukey->mutex); + } continue; }