Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9853384ybi; Wed, 10 Jul 2019 18:33:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8zUta8YKJ0klHUwG8mp5HrMjacoSNZiHm98oiUg90eNkFRmzE46+SOs2Y9cUm96RrNN5N X-Received: by 2002:a17:902:7781:: with SMTP id o1mr1463761pll.205.1562808822972; Wed, 10 Jul 2019 18:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562808822; cv=none; d=google.com; s=arc-20160816; b=KNDYojHYMkZtwLt+ZHbfOKXi9yYSKZbyp8gB2Sg4ycDjd2uzIfVd2hKSUeL1IMsMwP wTf1+pNi+NErJyJsJo54xnj6V4orysUzY/2cprFvEB383riXDkeX7IMtgTth0lVyV6is 8tps/QNqS+8+kyOZK0TxmnlvL74Tff4w7m5BysPlBvca/YPv39ahdBWXXscbAA6nuGvh jvWsy7MYBV5YnCRigV7RVGc9CzMhWRIBo1QgNHx9HUkX9QIOnfZuDCL26SZeGGJ42S8y u3Te7gq6cvJv44TUsaj9JCe0rahfZOeNKQIhFsr0Z9slzTY3ywn8sCe1gm1WlRlyFdW8 I2zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=JDmGUIv5i0f12G0hXs4i/wM728sENXzyjYApkXq8bxQ=; b=eKj99RXSjpCgeDYH24/rNKc8/W6sFwtPQ+IpOR3Rv8u372drhZucd8ygRSkIu3A+PN URAm+Xx5d0T5S9x/IFpfjKBzbRHBHIKkYlLdfgUAlBeKOK45M5vTDPXq4240vSTI13IU JK5IP2QN07r79b3+Io8PcpRQwDWZqG83483aOWT8xhmsQatZZkatNA3u5FZD+b4ZtQWq FCXi+J8wWU3SSZglm5z/BT1SO4HSd06R4MowPupveEzOjQBv5tSPdm+pD9FuXs+uuhb4 frc7aJHkG4no2y6cs7LvmddjV59mVDPjM21w+e21l8t0d9s8YUp95RyHkDheuxtV3Xoo 9PLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i18si3756703pfa.23.2019.07.10.18.33.13; Wed, 10 Jul 2019 18:33:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727541AbfGKBdH convert rfc822-to-8bit (ORCPT + 99 others); Wed, 10 Jul 2019 21:33:07 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:2482 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727708AbfGKBdH (ORCPT ); Wed, 10 Jul 2019 21:33:07 -0400 Received: from DGGEMM404-HUB.china.huawei.com (unknown [172.30.72.57]) by Forcepoint Email with ESMTP id D17612CC9601704C2F8C; Thu, 11 Jul 2019 09:33:04 +0800 (CST) Received: from DGGEMM507-MBX.china.huawei.com ([169.254.1.169]) by DGGEMM404-HUB.china.huawei.com ([10.3.20.212]) with mapi id 14.03.0439.000; Thu, 11 Jul 2019 09:32:57 +0800 From: Nixiaoming To: Greg KH CC: "adobriyan@gmail.com" , "akpm@linux-foundation.org" , "anna.schumaker@netapp.com" , "arjan@linux.intel.com" , "bfields@fieldses.org" , "chuck.lever@oracle.com" , "davem@davemloft.net" , "jlayton@kernel.org" , "luto@kernel.org" , "mingo@kernel.org" , "Nadia.Derbey@bull.net" , "paulmck@linux.vnet.ibm.com" , "semen.protsenko@linaro.org" , "stable@kernel.org" , "stern@rowland.harvard.edu" , "tglx@linutronix.de" , "torvalds@linux-foundation.org" , "trond.myklebust@hammerspace.com" , "viresh.kumar@linaro.org" , "vvs@virtuozzo.com" , "Huangjianhui (Alex)" , Dailei , "linux-kernel@vger.kernel.org" , "linux-nfs@vger.kernel.org" , "netdev@vger.kernel.org" Subject: RE: [PATCH v3 0/3] kernel/notifier.c: avoid duplicate registration Thread-Topic: [PATCH v3 0/3] kernel/notifier.c: avoid duplicate registration Thread-Index: AQHVNszeCdZobq+tm0y9Gm/hoQ9GDabC1LcAgAHObtA= Date: Thu, 11 Jul 2019 01:32:57 +0000 Message-ID: References: <1562728147-30251-1-git-send-email-nixiaoming@huawei.com> <20190710055628.GB5778@kroah.com> In-Reply-To: <20190710055628.GB5778@kroah.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.57.88.168] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, July 10, 2019 1:56 PM Greg KH wrote: >On Wed, Jul 10, 2019 at 11:09:07AM +0800, Xiaoming Ni wrote: >> Registering the same notifier to a hook repeatedly can cause the hook >> list to form a ring or lose other members of the list. > >Then don't do that :) > Duplicate registration is checked and exited in notifier_chain_cond_register() Duplicate registration was checked in notifier_chain_register() but only the alarm was triggered without exiting. added by commit 831246570d34692e ("kernel/notifier.c: double register detection") This patch is similar to commit 8312465 and notifier_chain_cond_register(), with actual prevention for such behaviour, which I think is necessary to avoid the formation of a linked list ring. >Is there any in-kernel users that do do this? If so, please just fix >them. > Notifier_chain_register() is not a hotspot path. Adding a check here can make the kernel more stable. Thanks Xiaoming Ni >thanks, > >greg k-h >