Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755842Ab0BJUDF (ORCPT ); Wed, 10 Feb 2010 15:03:05 -0500 Received: from rcsinet12.oracle.com ([148.87.113.124]:17321 "EHLO rcsinet12.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755538Ab0BJUDA (ORCPT ); Wed, 10 Feb 2010 15:03:00 -0500 Date: Wed, 10 Feb 2010 15:01:34 -0500 From: Chris Mason To: Jiri Slaby Cc: linux-kernel@vger.kernel.org, jirislaby@gmail.com, linux-btrfs@vger.kernel.org Subject: Re: [PATCH 1/1] FS: btrfs, use helpers for rlimits Message-ID: <20100210200134.GK18175@think> Mail-Followup-To: Chris Mason , Jiri Slaby , linux-kernel@vger.kernel.org, jirislaby@gmail.com, linux-btrfs@vger.kernel.org References: <1265832009-8070-1-git-send-email-jslaby@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1265832009-8070-1-git-send-email-jslaby@suse.cz> User-Agent: Mutt/1.5.20 (2009-06-14) X-Source-IP: acsmt353.oracle.com [141.146.40.153] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090201.4B7310DC.0080:SCFMA4539814,ss=1,fgs=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1419 Lines: 42 Thanks, I have this queued up for .34 -chris On Wed, Feb 10, 2010 at 09:00:09PM +0100, Jiri Slaby wrote: > Make sure compiler won't do weird things with limits. E.g. fetching > them twice may return 2 different values after writable limits are > implemented. > > I.e. either use rlimit helpers added in > 3e10e716abf3c71bdb5d86b8f507f9e72236c9cd > or ACCESS_ONCE if not applicable. > > Signed-off-by: Jiri Slaby > Cc: Chris Mason > Cc: linux-btrfs@vger.kernel.org > --- > fs/btrfs/inode.c | 3 +-- > 1 files changed, 1 insertions(+), 2 deletions(-) > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index c41db6d..5aa0cef 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -3256,8 +3256,7 @@ static int btrfs_setattr_size(struct inode *inode, struct iattr *attr) > return 0; > > if (attr->ia_size > inode->i_size) { > - unsigned long limit; > - limit = current->signal->rlim[RLIMIT_FSIZE].rlim_cur; > + unsigned long limit = rlimit(RLIMIT_FSIZE); > if (attr->ia_size > inode->i_sb->s_maxbytes) > return -EFBIG; > if (limit != RLIM_INFINITY && attr->ia_size > limit) { > -- > 1.6.6.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/