From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Teigland Subject: Re: [RFC PATCH] locks: skip posix unlock when there are no posix locks Date: Fri, 19 Aug 2011 11:07:19 -0400 Message-ID: <20110819150719.GA14345@redhat.com> References: <20110818203816.GB315@redhat.com> <1313746839.2704.29.camel@menhir> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: Steven Whitehouse Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50468 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751832Ab1HSPHW (ORCPT ); Fri, 19 Aug 2011 11:07:22 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7JF7MLm015536 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 19 Aug 2011 11:07:22 -0400 Content-Disposition: inline In-Reply-To: <1313746839.2704.29.camel@menhir> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Aug 19, 2011 at 10:40:39AM +0100, Steven Whitehouse wrote: > > - if (!filp->f_path.dentry->d_inode->i_flock) > > + inode = filp->f_path.dentry->d_inode; > > + > > + if (!inode->i_flock) > > return; > > > So if you take the lock at this point, and drop it after the loop, that > should resolve the issue without incurring the extra overhead on every > single close, Yep, thanks. > > + for_each_lock(inode, before) { > > + struct file_lock *fl = *before; > > + if (IS_POSIX(fl)) > > + goto do_unlock; > > + } > > + return; > > + > > +do_unlock: > > lock.fl_type = F_UNLCK; > > lock.fl_flags = FL_POSIX | FL_CLOSE; > > lock.fl_start = 0; >