From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751126AbWBRKHg (ORCPT ); Sat, 18 Feb 2006 05:07:36 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751128AbWBRKHg (ORCPT ); Sat, 18 Feb 2006 05:07:36 -0500 Received: from e4.ny.us.ibm.com ([32.97.182.144]:55529 "EHLO e4.ny.us.ibm.com") by vger.kernel.org with ESMTP id S1751126AbWBRKHg (ORCPT ); Sat, 18 Feb 2006 05:07:36 -0500 Date: Sat, 18 Feb 2006 15:36:29 +0530 From: Dipankar Sarma To: Andrew Morton Cc: linux-kernel@vger.kernel.org, paulmck@us.ibm.com, dada1@cosmosbay.com Subject: Re: [PATCH 2/2] fix file counting Message-ID: <20060218100629.GQ29846@in.ibm.com> Reply-To: dipankar@in.ibm.com References: <20060217154147.GL29846@in.ibm.com> <20060217154337.GM29846@in.ibm.com> <20060217154626.GN29846@in.ibm.com> <20060218010414.1f8d6782.akpm@osdl.org> <20060218092517.GP29846@in.ibm.com> <20060218014529.5f160d39.akpm@osdl.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060218014529.5f160d39.akpm@osdl.org> User-Agent: Mutt/1.5.11 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 18, 2006 at 01:45:29AM -0800, Andrew Morton wrote: > Dipankar Sarma wrote: > > > > > > Slight optimization - > > > > if (get_nr_files() >= files_stat.max_files) { > > if (capable(CAP_SYS_ADMIN)) { > > /* > > * percpu_counters are inaccurate. Do an expensive check before > > * we go and fail. > > */ > > if (percpu_counter_sum(&nr_files) >= > > files_stat.max_files) > > goto over; > > } else > > goto over; > > } > > That changes the behaviour for root. Maybe you meant !capable(), but that > still changes the behaviour. I'm all confused. Hmm.. on second thoughts, there is no harm doing the expensive check for both priviledged and non-priviledged user. It will correctly allow non-priviledged users to create the new file provided the fast-path percpu counter value returned was greater than the slow path per-cpu counter value. Just ignore my comment in the previous mail. Thanks Dipankar