linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-fsdevel@vger.kernel.org
Cc: jack@suse.cz, Dmitry Monakhov <dmonakhov@openvz.org>
Subject: [PATCH] quota: add per-inode reservaton space sanity checks.
Date: Tue, 30 Mar 2010 18:25:28 +0400	[thread overview]
Message-ID: <1269959128-9626-1-git-send-email-dmonakhov@openvz.org> (raw)

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);
 	*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);
 	*inode_reserved_space(inode) -= number;
 	spin_unlock(&inode->i_lock);
 }
-- 
1.6.6.1


             reply	other threads:[~2010-03-30 14:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30 14:25 Dmitry Monakhov [this message]
2010-03-30 15:39 ` [PATCH] quota: add per-inode reservaton space sanity checks Jan Kara
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=1269959128-9626-1-git-send-email-dmonakhov@openvz.org \
    --to=dmonakhov@openvz.org \
    --cc=jack@suse.cz \
    --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).