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,URIBL_BLOCKED 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 B9B3CC43381 for ; Fri, 1 Mar 2019 23:53:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 89B8D206DD for ; Fri, 1 Mar 2019 23:53:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726002AbfCAXvh (ORCPT ); Fri, 1 Mar 2019 18:51:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40860 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725934AbfCAXvh (ORCPT ); Fri, 1 Mar 2019 18:51:37 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C496308B79E; Fri, 1 Mar 2019 23:51:37 +0000 (UTC) Received: from localhost (ovpn-200-19.brq.redhat.com [10.40.200.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E6EC60856; Fri, 1 Mar 2019 23:51:34 +0000 (UTC) Date: Sat, 2 Mar 2019 00:51:29 +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 v2 04/12] net: sched: flower: track filter deletion with flag Message-ID: <20190302005129.4d4508c9@redhat.com> In-Reply-To: <20190227101226.26196-5-vladbu@mellanox.com> References: <20190227101226.26196-1-vladbu@mellanox.com> <20190227101226.26196-5-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.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 01 Mar 2019 23:51:37 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Vlad, On Wed, 27 Feb 2019 12:12:18 +0200 Vlad Buslov wrote: > -static bool __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f, > - struct netlink_ext_ack *extack) > +static int __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f, > + bool *last, struct netlink_ext_ack *extack) > { > struct cls_fl_head *head = fl_head_dereference(tp); > bool async = tcf_exts_get_net(&f->exts); > - bool last; > > + *last = false; > + > + if (f->deleted) > + return -ENOENT; > + > + f->deleted = true; Now that I can read this more easily :) I have a doubt: you say this flag "prevent[s] double deletion of filter by concurrent tasks". However, if this has no further protections (which I can't readily see), I think this is racy: task 1 task 2 if (f->deleted) [false] if (f->deleted) [false] f->deleted = true; f->deleted = true; what am I missing here? -- Stefano