linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-fsdevel@vger.kernel.org, jack@suse.cz
Subject: Re: [PATCH] quota: add per-inode reservaton space sanity checks.
Date: Tue, 30 Mar 2010 17:39:34 +0200	[thread overview]
Message-ID: <20100330153933.GC3424@quack.suse.cz> (raw)
In-Reply-To: <1269959128-9626-1-git-send-email-dmonakhov@openvz.org>

On Tue 30-03-10 18:25:28, Dmitry Monakhov wrote:
> We already has per-dquot sanity checks, but with per-inode checks
> quota leakage investigation becomes much easier.
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
>  fs/quota/dquot.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index e0b870f..4db57b7 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -1428,6 +1428,8 @@ EXPORT_SYMBOL(inode_add_rsv_space);
>  void inode_claim_rsv_space(struct inode *inode, qsize_t number)
>  {
>  	spin_lock(&inode->i_lock);
> +	if (*inode_reserved_space(inode) < number)
> +		WARN_ON_ONCE(1);
  Maybe just: WARN_ON_ONCE(*inode_reserved_space(inode) < number)

>  	*inode_reserved_space(inode) -= number;
>  	__inode_add_bytes(inode, number);
>  	spin_unlock(&inode->i_lock);
> @@ -1437,6 +1439,8 @@ EXPORT_SYMBOL(inode_claim_rsv_space);
>  void inode_sub_rsv_space(struct inode *inode, qsize_t number)
>  {
>  	spin_lock(&inode->i_lock);
> +	if (*inode_reserved_space(inode) < number)
> +		WARN_ON_ONCE(1);
  And here as well...

>  	*inode_reserved_space(inode) -= number;
>  	spin_unlock(&inode->i_lock);
>  }
  But otherwise I agree...

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2010-03-30 15:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30 14:25 [PATCH] quota: add per-inode reservaton space sanity checks Dmitry Monakhov
2010-03-30 15:39 ` Jan Kara [this message]
2010-03-30 16:20   ` dmonakhov
2010-03-31  5:20     ` Dmitry Monakhov
2010-03-31  6:55       ` Dave Chinner
2010-03-31  7:17         ` dmonakhov
2010-03-31 23:23           ` Dave Chinner
2010-03-31 14:29       ` 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=20100330153933.GC3424@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=dmonakhov@openvz.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).