From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Piggin Subject: Re: [PATCH] vfs: reorganize inode chattr checks Date: Thu, 18 Mar 2010 10:44:56 +1100 Message-ID: <20100317234455.GA25636@laptop> References: <87pr32yix3.fsf@openvz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, Al Viro To: Dmitry Monakhov Return-path: Received: from cantor2.suse.de ([195.135.220.15]:33896 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753305Ab0CQXpA (ORCPT ); Wed, 17 Mar 2010 19:45:00 -0400 Content-Disposition: inline In-Reply-To: <87pr32yix3.fsf@openvz.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Mar 17, 2010 at 08:09:12PM +0300, Dmitry Monakhov wrote: > > This patch fix nasty bug with truncate on swapfile. > It contains only vfs core helpers and fix isize check path for > fs w/o i_op->setattr method. Later i'll send corresponding changes > to other fs which has ->setattr method. > > This patch is depends on Nick's patch > http://marc.info/?l=linux-fsdevel&m=126752788514574&w=2 > > >From e8587585b2e2fefb75d47f8d50ddc7099a50873c Mon Sep 17 00:00:00 2001 > From: Dmitry Monakhov > Date: Wed, 17 Mar 2010 19:49:22 +0300 > Subject: [PATCH] vfs: reorganize inode chattr checks > > vmtrucate may fail due to IS_SWAPFILE flag or due to RLIMIT_FSIZE. > In some situations it is not acceptable behaviour. Off course > we can check IS_SWAPFILE before but what about RLIMIT_FSIZE? > > Let's divide newsize seting logic in two parts > First which perform necessery size checks > Second which does the work and can not fail. > And perform size check before any inode modifications. Yep, I think it is a good idea to perform these checks as early as possible.