From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFD29C43381 for ; Fri, 15 Feb 2019 22:46:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AD56F222DD for ; Fri, 15 Feb 2019 22:46:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404567AbfBOWqb (ORCPT ); Fri, 15 Feb 2019 17:46:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41188 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404037AbfBOWqb (ORCPT ); Fri, 15 Feb 2019 17:46:31 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9055AC614; Fri, 15 Feb 2019 22:46:30 +0000 (UTC) Received: from localhost (ovpn-200-19.brq.redhat.com [10.40.200.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 638D919C65; Fri, 15 Feb 2019 22:46:28 +0000 (UTC) Date: Fri, 15 Feb 2019 23:46:23 +0100 From: Stefano Brivio To: Vlad Buslov Cc: netdev@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net Subject: Re: [PATCH net-next 06/12] net: sched: flower: handle concurrent mask insertion Message-ID: <20190215234623.565166a4@redhat.com> In-Reply-To: <20190214074712.17846-7-vladbu@mellanox.com> References: <20190214074712.17846-1-vladbu@mellanox.com> <20190214074712.17846-7-vladbu@mellanox.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 15 Feb 2019 22:46:31 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, 14 Feb 2019 09:47:06 +0200 Vlad Buslov wrote: > @@ -1327,19 +1330,36 @@ static int fl_check_assign_mask(struct cls_fl_head *head, > int ret = 0; > > rcu_read_lock(); > - fnew->mask = rhashtable_lookup_fast(&head->ht, mask, mask_ht_params); > + > + /* Insert mask as temporary node to prevent concurrent creation of mask > + * with same key. Any concurrent lookups with same key will return > + * EAGAIN because mask's refcnt is zero. It is safe to insert Nit: -EAGAIN -- Stefano