ext4: fix quota charging for shared xattr blocks

ext4_xattr_block_set() calls dquot_alloc_block() to charge for an xattr
block when new references are made. However if dquot_initialize() hasn't
been called on an inode, request for charging is effectively ignored
because ext4_inode_info->i_dquot is not initialized yet.

Add dquot_initialize() to call paths that lead to ext4_xattr_block_set().

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Tahsin Erdogan 2017-05-24 18:24:07 -04:00 committed by Theodore Ts'o
parent c41d342b39
commit b8cb5a545c
5 changed files with 37 additions and 0 deletions

View file

@ -44,6 +44,7 @@ void inode_sub_rsv_space(struct inode *inode, qsize_t number);
void inode_reclaim_rsv_space(struct inode *inode, qsize_t number);
int dquot_initialize(struct inode *inode);
bool dquot_initialize_needed(struct inode *inode);
void dquot_drop(struct inode *inode);
struct dquot *dqget(struct super_block *sb, struct kqid qid);
static inline struct dquot *dqgrab(struct dquot *dquot)
@ -207,6 +208,11 @@ static inline int dquot_initialize(struct inode *inode)
return 0;
}
static inline bool dquot_initialize_needed(struct inode *inode)
{
return false;
}
static inline void dquot_drop(struct inode *inode)
{
}