Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp564456imm; Wed, 8 Aug 2018 01:38:23 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxrRPuYGcTPJDGq7GIBebjZ7Q+C8f+X4bOhMiJG7s+S/KxAqR2CCCsEgOsaprANjn54mrzK X-Received: by 2002:a17:902:88:: with SMTP id a8-v6mr1659852pla.156.1533717503693; Wed, 08 Aug 2018 01:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533717503; cv=none; d=google.com; s=arc-20160816; b=ISX9rymQADL+sG+og2LATgswY5V7cf9ps0BTewtlHth5HOQ1LzGLW4bH7EXqHttTTt 1wO9ywVVfYBzFqj+89SkunprdnvxAGzl8I96K+UPU9KiiibSQG3iVQ173Kl0MfAPhuqR PVJXOl/Tv1zJoniZV88rrHErAxxUgLpi8+a0dDtyNkASGnHDKqGxSoAbVC60cSBbCSZS Lxe3q5w8Yc+C9XRsvcMdc0lPqfbAfBibfoofuCvakgiCz+SHbRpncxiloMRabuzj1t13 ug/Cxj7G/O23+CwQza7eSnmKrVAbD8oxH5MdRLfvio9FyQdWfkURJ1ApXY0tDtZj3fvc iydQ== 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:arc-authentication-results; bh=whqHnYfH1WwW12j8ut0xN31RbcukAPeFxuXpQpHmyi4=; b=Eb9VuEu4bgvvIBXmlns0aL/IX1YtRhgGV6nd2cZcPv9De5tBtVFr6Q2NO+NmZvLE57 3Vn8DSErcrvhbS6pnb+Wiqw3qDWTWMtfECFKgiHEK+67P248REftaFP9E8qfgtJi12l9 1EzwllV2x2Xj9Nx89MNNeRDRurKtTxvwFWXE0teUmjZ/Pw85a8NKXFjEU35iP39AqwYM L1GnvyYkJEwXIlBhzbDmZn2DaPHqOXpzQLW+LIUbdntcaQsIOJno7W+ncOTRAgk2jbDR 7FHt9s6NiV5cAfd6P6pY+wQFhg44NHLanT0cJxF+N637f7QwLcG4+yoUJ7V6AiEsbowm kDHQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z17-v6si3879823pgk.183.2018.08.08.01.38.08; Wed, 08 Aug 2018 01:38:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727174AbeHHKz0 (ORCPT + 99 others); Wed, 8 Aug 2018 06:55:26 -0400 Received: from nautica.notk.org ([91.121.71.147]:53441 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727074AbeHHKz0 (ORCPT ); Wed, 8 Aug 2018 06:55:26 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id BE51AC009; Wed, 8 Aug 2018 10:36:45 +0200 (CEST) Date: Wed, 8 Aug 2018 10:36:30 +0200 From: Dominique Martinet To: piaojun Cc: "akpm@linux-foundation.org" , Eric Van Hensbergen , Ron Minnich , Latchesar Ionkov , Greg Kurz , Linux Kernel Mailing List , v9fs-developer@lists.sourceforge.net Subject: Re: [PATCH] net/9p/trans_virtio.c: decrease the refcount of 9p virtio device when removing it Message-ID: <20180808083630.GB16121@nautica> References: <5B6AA65E.3030907@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5B6AA65E.3030907@huawei.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 piaojun wrote on Wed, Aug 08, 2018: > I found that 9pnet_virtio.ko could not be removed by rmmod command, and I > could still found it by lsmod. The reason is that we forgot decrease the > refcount of 9p virtio device by kobject_put. So we should put refcount in > p9_virtio_remove. Hmm, I cannot seem to reproduce this. Can you give more details on how to get into stuck state? I tried mounting something, accessing the sysfs files, etc to no avail. lsmod gives a counter to how many references there are to the module, you can use that to debug a bit. For example here I get this line just after loading the module: 9pnet_virtio 32768 0 Then after mounting something there is one reference: 9pnet_virtio 32768 1 Then unmounting puts that back to 0 and 'modprobe -r' (or rmmod) works. I dislike saying the next part but I think form also is important, please bear with me: - shorter subject line, please. For example, you can lose 20 characters by reodering words so there is no need for pronouns "net/9p/virtio: decrease 9p virtio device refcount on removal" - I personally dislike commit messages that are "novelized" (that is, put yourself as an actor and describe what you were doing) That seems to be somewhat accepted as looking at the kernel's git log I see some (few) commits using "I ..." that are not pull request messages but if possible please avoid this style and try to describe facts, how things are wrong, what got fixed and if required how. To give an example again, this says the same thing: "The 9pnet_virtio module could not be unloaded because we forgot to decrease the refcount of the 9p virtio device with kobject_put. Put the reference in 9p_virtio_remove" Thanks, -- Dominique