diff options
author | Tahsin Erdogan <tahsin@google.com> | 2017-05-25 00:24:07 +0200 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2017-05-25 00:24:07 +0200 |
commit | b8cb5a545c3dd8b975aad19ea020eabe0a888e8d (patch) | |
tree | 922a559467f7a606bede9f9892731ec414ea9dc4 /fs/quota | |
parent | ext4: remove redundant check for encrypted file on dio write path (diff) | |
download | linux-b8cb5a545c3dd8b975aad19ea020eabe0a888e8d.tar.xz linux-b8cb5a545c3dd8b975aad19ea020eabe0a888e8d.zip |
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>
Diffstat (limited to 'fs/quota')
-rw-r--r-- | fs/quota/dquot.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index ebf80c7739e1..48813aeaab80 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1512,6 +1512,22 @@ int dquot_initialize(struct inode *inode) } EXPORT_SYMBOL(dquot_initialize); +bool dquot_initialize_needed(struct inode *inode) +{ + struct dquot **dquots; + int i; + + if (!dquot_active(inode)) + return false; + + dquots = i_dquot(inode); + for (i = 0; i < MAXQUOTAS; i++) + if (!dquots[i] && sb_has_quota_active(inode->i_sb, i)) + return true; + return false; +} +EXPORT_SYMBOL(dquot_initialize_needed); + /* * Release all quotas referenced by inode. * |