From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sasl.smtp.pobox.com (a-sasl-fastnet.sasl.smtp.pobox.com [207.106.133.19]) by ozlabs.org (Postfix) with ESMTP id 1D52BDE2FF for ; Wed, 2 Apr 2008 03:35:38 +1100 (EST) Date: Tue, 1 Apr 2008 11:35:04 -0500 From: Nathan Lynch To: Jens Osterkamp Subject: Re: [PATCH] RTAS - adapt procfs interface Message-ID: <20080401163504.GP7137@localdomain> References: <200804011512.20834.jens@de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <200804011512.20834.jens@de.ibm.com> Cc: maxim@de.ibm.com, linuxppc-dev@ozlabs.org, Paul Mackerras , cbe-oss-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Jens Osterkamp wrote: > > Handling of the proc_dir_entry->count has being changed in 2.6.24-rc5. Do you know which commit caused the change? > After this change the default value for pde->count is 1 and not 0 as it > was in earlier kernels. Therefore, if we want to check wether our procfs > file is already opened (already in use), we have to check if pde->count > is not greater than 2 but not 1. > > Signed-off-by: Maxim Shchetynin > Signed-off-by: Jens Osterkamp > > Index: linux-2.6/arch/powerpc/kernel/rtas_flash.c > =================================================================== > --- linux-2.6.orig/arch/powerpc/kernel/rtas_flash.c > +++ linux-2.6/arch/powerpc/kernel/rtas_flash.c > @@ -356,7 +356,7 @@ static int rtas_excl_open(struct inode * > > /* Enforce exclusive open with use count of PDE */ > spin_lock(&flash_file_open_lock); > - if (atomic_read(&dp->count) > 1) { > + if (atomic_read(&dp->count) > 2) { > spin_unlock(&flash_file_open_lock); > return -EBUSY; > } One could argue that the real problem is using the proc_dir_entry's reference count to enforce exclusive open.