From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: proc:Add a reference of module when proc_reg_file opened Date: Sun, 26 Feb 2012 07:50:25 +0000 Message-ID: <20120226075025.GC23916@ZenIV.linux.org.uk> References: <201202261434450622160@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel To: majianpeng Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:53630 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751074Ab2BZHu0 (ORCPT ); Sun, 26 Feb 2012 02:50:26 -0500 Content-Disposition: inline In-Reply-To: <201202261434450622160@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sun, Feb 26, 2012 at 02:34:48PM +0800, majianpeng wrote: > >From 49b46362bf3221a259bfc73105ad041376b66878 Mon Sep 17 00:00:00 2001 > From: majianpeng > Date: Sun, 26 Feb 2012 22:19:51 +0800 > Subject: [PATCH] proc:Add a reference of module when proc_reg_file opened. > > If struct file_operations of a regular file in procfs defined in module > and defined .owner = THIS_MODULE,open this file must get a reference of > module. No. Read remove_proc_entry(), especially the part under ->pde_unload_lock. The whole damn point of that stuff is that opened file on procfs does *not* pin the module down; IO in progress does, but that's it. You can't deadlock rmmod foobar