Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3486233yba; Tue, 16 Apr 2019 12:20:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6REgxuclpF8L/QVaL+elO6Fd1L2XV7sP3RHQUeYEzVo08/TQVyGDQruvarhgfqc5wR19t X-Received: by 2002:a62:7591:: with SMTP id q139mr70828799pfc.14.1555442426363; Tue, 16 Apr 2019 12:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555442426; cv=none; d=google.com; s=arc-20160816; b=eB17IGwzzg8VLoSuE7L38NWjPzHlTMKpQ7HqqK8uxT35WQkkZJxrCNdxwviumdEgLo 5qksNAsFkkwBN1k4eIl7BLWVim5zrt71sE7P9tdbrOA0q5qxheU1TBBMM0PCsiq175/V RVPccPAFBKB+7IFsWi6+VD6VWGxp9TQOM/abjQGwCMg77TF+/xHEB9YbghrwEBhAZ1y4 6iGyRFcYQOpk28gwDrl+G/qmMvNdn7S45lC2XVAVQHU+9yjq58WO+hJTNLFS/pFva2mz UbUqZ47u3IZEhQScYS2Ml2eWsUiLNInaMo16W893GXGYhJpoi7TojOuXXNju0dozcZM7 YL8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=v8LNHinSAWsRwFIAeDbz9HBGrKYVLRo7R09JylxmB0o=; b=qrXD8b2MojmC1hOoKKcE55wnw6ZlAhWzJsYFNHEAUPSF8q0FhOnmDfwzk1n7JdSIMT bBc6WuJ+z7PIRjZthpVEtj6u+y4xn1aSL+1vdfLdx2uZ3Tv0/HpVmzAPT36Se3PiOiRy M+yG4W42RSOVeW8IbvI2PVypgUyrI9J/qSOHrGrdi7/qmcOrgeeKOsKKa4aE213ugqnF vuGOi6HwpE+VWKSHZGwpKhhDfg+E6AHhayZJdUHsIlAgu9AFUupUJBqrBB4smL3yCE8e UDue98plKGfuec7sSW0aNUq1jl0Zn+USfphLGun+2P518uV6dYBtvklw9PYqc4uodZk7 q9xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=OV+0PMnN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si10164963plc.236.2019.04.16.12.20.09; Tue, 16 Apr 2019 12:20:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=OV+0PMnN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730263AbfDPTRc (ORCPT + 99 others); Tue, 16 Apr 2019 15:17:32 -0400 Received: from mail-yb1-f196.google.com ([209.85.219.196]:36718 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727180AbfDPTRc (ORCPT ); Tue, 16 Apr 2019 15:17:32 -0400 Received: by mail-yb1-f196.google.com with SMTP id e76so8193854ybc.3 for ; Tue, 16 Apr 2019 12:17:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=v8LNHinSAWsRwFIAeDbz9HBGrKYVLRo7R09JylxmB0o=; b=OV+0PMnNogS0CKUY/MoNhjHD9MsmHFDoB/ap24DIZmHRGdGikia0A3ajEezOy+GAsJ PnVWtyrz/ZwF5PznqiFLwU1wpgBaQgLspGZWY+o4wn707WlY25KxFMGGy7gcoLHPkzxQ PCfIT9mHMcJW28Z2DOdvh1So2pqxvuFTctVYAvkDx7ujnhcAkNjFVKxNXHCTmv0lFBzO LBs0YE0spWnHprcM5FoLgyrgB5OwYCaJQfUxNWz/ZaT7jfG+LIW+KBarXmjln1aZdCgu 3p4opfmIuiB6X7bwCKWlYZ+TGJ1MAL8TxzBJKHnBuWk1ywc67HWigOYSd5BGP5uFVabu rTcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=v8LNHinSAWsRwFIAeDbz9HBGrKYVLRo7R09JylxmB0o=; b=qfoMSV2NDuMdN4/89yUOWSP7o0L2F+j16IzykmduVh87Kz1Q54FMdM2EQsVuZw2QAe 1USrRXKogW+J/uTHZDJXMOL99+fd+2SYfmwOdjs968RgCkMybTOjYONb+AF0BtsIl3RY /WSCQRu3CTEIEY3r208wPPEdeT//AIV1B06X2alJLJoTJljtqBjtmKzJ4FBXzuGCIZ+8 ZrROaMi0uPDDWpjUu7UQO1MMjoPCgeJu/r5r2dFjQ0GNQlLlpauuN1Vgl0GBnNNRq+0v TSJUhOn+hCGbaFhvqdyumtIShAwpPhbLcxp1mJCpnQjOekzphj52nVSoGHtMzeQ7N9Kl ZZ9A== X-Gm-Message-State: APjAAAVWfPqkl2vPBHqfXIAW0PHoUFZMfWkxHL7AjNPMM7PotYJiW1J2 GcPnOSqrS+gZDTFzTtpOduE= X-Received: by 2002:a25:9703:: with SMTP id d3mr55763549ybo.113.1555442250507; Tue, 16 Apr 2019 12:17:30 -0700 (PDT) Received: from localhost ([2620:10d:c091:200::c7e0]) by smtp.gmail.com with ESMTPSA id y70sm22283236ywy.86.2019.04.16.12.17.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Apr 2019 12:17:29 -0700 (PDT) Date: Tue, 16 Apr 2019 12:17:27 -0700 From: Tejun Heo To: Konstantin Khorenko Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC 1/1] kernfs: keep kernfs node alive for __kernfs_remove() Message-ID: <20190416191727.GD374014@devbig004.ftw2.facebook.com> References: <20190416155335.14627-1-khorenko@virtuozzo.com> <20190416155335.14627-2-khorenko@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190416155335.14627-2-khorenko@virtuozzo.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 16, 2019 at 06:53:35PM +0300, Konstantin Khorenko wrote: > __kernfs_remove() which is called under kernfs_mutex, > assumes nobody kills kernfs node whie it's working on it > and "get"s current kernfs node for that. > > But we hit a warning in kernfs_get(): kn->counter == 0 already: > ------------[ cut here ]------------ > WARNING: CPU: 2 PID: 63923 at fs/kernfs/dir.c:377 kernfs_get+0x2f/0x40 > ... > Call Trace: > [] dump_stack+0x19/0x1b > [] __warn+0xd8/0x100 > [] warn_slowpath_null+0x1d/0x20 > [] kernfs_get+0x2f/0x40 > [] __kernfs_remove+0x113/0x260 > [] kernfs_remove+0x21/0x30 > [] sysfs_remove_dir+0x50/0x80 > [] kobject_del+0x18/0x50 > [] sysfs_slab_remove+0x3d/0x50 > [] do_kmem_cache_release+0x3b/0x70 > [] memcg_destroy_kmem_caches+0xb1/0xf0 > [] mem_cgroup_css_free+0x4c/0x280 > [] cgroup_free_fn+0x4c/0x120 > [] process_one_work+0x182/0x440 > [] worker_thread+0x126/0x3c0 > [] kthread+0xd1/0xe0 > > This could be for example because of kernfs_notify_workfn() which > does kernfs_put(kn) out of kernfs_mutex held section, > so move kernfs_put(kn) under the mutex. This patch doesn't really make sense to me. Can you give a more concrete scenario where this would help? Thanks. -- tejun