All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, jack@suse.cz
Subject: Re: [PATCH 2/2] quota: check quota reservation on remove_dquot_ref
Date: Tue, 1 Jun 2010 13:54:33 +0200	[thread overview]
Message-ID: <20100601115433.GD4275@quack.suse.cz> (raw)
In-Reply-To: <1275377988-4299-2-git-send-email-dmonakhov@openvz.org>

On Tue 01-06-10 11:39:48, Dmitry Monakhov wrote:
> Reserved space must being claimed before remove_dquot_ref() for a
> given inode. Filesystem is responsible for performing force blocks
> allocation in case of dealloc in ->quota_off. Let's add sanity check
> for that case. Do it similar to add_dquot_ref().
  Thanks. I've merged this patch since it's independent of the first one
(and unless someone runs with CONFIG_QUOTA_DEBUG it shouldn't cause
additional warnings either).

								Honza

> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
>  fs/quota/dquot.c |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 12c233d..dfb8c16 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -986,6 +986,7 @@ static void remove_dquot_ref(struct super_block *sb, int type,
>  		struct list_head *tofree_head)
>  {
>  	struct inode *inode;
> +	int reserved = 0;
>  
>  	spin_lock(&inode_lock);
>  	list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
> @@ -995,10 +996,21 @@ static void remove_dquot_ref(struct super_block *sb, int type,
>  		 *  only quota pointers and these have separate locking
>  		 *  (dqptr_sem).
>  		 */
> -		if (!IS_NOQUOTA(inode))
> +		if (!IS_NOQUOTA(inode)) {
> +			if (unlikely(inode_get_rsv_space(inode) > 0))
> +				reserved = 1;
>  			remove_inode_dquot_ref(inode, type, tofree_head);
> +		}
>  	}
>  	spin_unlock(&inode_lock);
> +#ifdef CONFIG_QUOTA_DEBUG
> +	if (reserved) {
> +		printk(KERN_WARNING "VFS (%s): Writes happened after quota"
> +			" was disabled thus quota information is probably "
> +			"inconsistent. Please run quotacheck(8).\n", sb->s_id);
> +	}
> +#endif
> +
>  }
>  
>  /* Gather all references from inodes and drop them */
> -- 
> 1.6.6.1
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2010-06-01 11:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-28 11:27 [PATCH 1/2] ext4: force block allocation on quota_off Dmitry Monakhov
2010-05-28 11:27 ` [PATCH 2/2] quota: check quota reservation on remove_dquot_ref Dmitry Monakhov
2010-05-31 19:11 ` [PATCH 1/2] ext4: force block allocation on quota_off Jan Kara
2010-06-01  7:39   ` Dmitry Monakhov
2010-06-01  7:39     ` [PATCH 2/2] quota: check quota reservation on remove_dquot_ref Dmitry Monakhov
2010-06-01 11:54       ` Jan Kara [this message]
2010-06-01 12:11     ` [PATCH 1/2] ext4: force block allocation on quota_off Jan Kara
2010-06-05 14:55       ` tytso
2010-06-06 22:36         ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100601115433.GD4275@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=dmonakhov@openvz.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.