quota: Fix dquot_transfer for filesystems different from ext4
authorJan Kara <jack@suse.cz>
Wed, 6 Jan 2010 17:03:36 +0000 (18:03 +0100)
committerJan Kara <jack@suse.cz>
Mon, 11 Jan 2010 12:06:41 +0000 (13:06 +0100)
Commit fd8fbfc1 modified the way we find amount of reserved space
belonging to an inode. The amount of reserved space is checked
from dquot_transfer and thus inode_reserved_space gets called
even for filesystems that don't provide get_reserved_space callback
which results in a BUG.

Fix the problem by checking get_reserved_space callback and return 0 if
the filesystem does not provide it.

CC: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/quota/dquot.c

index dea86abdf2e7fe8ca6589dc0ba22210357a28d01..3fc62b097bedac541f2ada3309932b0953f8bbda 100644 (file)
@@ -1377,6 +1377,9 @@ static void inode_sub_rsv_space(struct inode *inode, qsize_t number)
 static qsize_t inode_get_rsv_space(struct inode *inode)
 {
        qsize_t ret;
+
+       if (!inode->i_sb->dq_op->get_reserved_space)
+               return 0;
        spin_lock(&inode->i_lock);
        ret = *inode_reserved_space(inode);
        spin_unlock(&inode->i_lock);