Skip to content

Commit

Permalink
quota: add missing use of dq_data_lock in __dquot_initialize
Browse files Browse the repository at this point in the history
The bulk of __dquot_initialize runs under the dqptr_sem which
protects the inode->i_dquot pointers. It doesn't protect the
dereferenced contents, though. Those are protected by the
dq_data_lock, which is missing around the dquot_resv_space call.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jeff Mahoney authored and Jan Kara committed Mar 11, 2013
1 parent f6161aa commit 68ac8bf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/quota/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1439,8 +1439,11 @@ static void __dquot_initialize(struct inode *inode, int type)
* did a write before quota was turned on
*/
rsv = inode_get_rsv_space(inode);
if (unlikely(rsv))
if (unlikely(rsv)) {
spin_lock(&dq_data_lock);
dquot_resv_space(inode->i_dquot[cnt], rsv);
spin_unlock(&dq_data_lock);
}
}
}
out_err:
Expand Down

0 comments on commit 68ac8bf

Please sign in to comment.