Re: [PATCH] quota: add per-inode reservaton space sanity checks.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Kara <jack@xxxxxxx> writes:

> 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@xxxxxxxxxx>
>> ---
>>  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)
As you wish.
>From 610afddec4ae4e33d2481284d2c3463439284833 Mon Sep 17 00:00:00 2001
From: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
Date: Tue, 30 Mar 2010 20:08:12 +0400
Subject: [PATCH] quota: add per-inode reservaton space sanity checks.

We already has per-dquot sanity checks, but with per-inode checks
quota leakage investigation becomes much easier.

Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
---
 fs/quota/dquot.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index e0b870f..f1c50e4 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1428,6 +1428,7 @@ EXPORT_SYMBOL(inode_add_rsv_space);
 void inode_claim_rsv_space(struct inode *inode, qsize_t number)
 {
 	spin_lock(&inode->i_lock);
+	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 +1438,7 @@ EXPORT_SYMBOL(inode_claim_rsv_space);
 void inode_sub_rsv_space(struct inode *inode, qsize_t number)
 {
 	spin_lock(&inode->i_lock);
+	WARN_ON_ONCE(*inode_reserved_space(inode) < number);
 	*inode_reserved_space(inode) -= number;
 	spin_unlock(&inode->i_lock);
 }
-- 
1.6.6.1


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux