quota: add missing lock into __dquot_transfer()
authorKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Sat, 9 Sep 2017 09:19:22 +0000 (12:19 +0300)
committerJan Kara <jack@suse.cz>
Mon, 18 Sep 2017 10:23:58 +0000 (12:23 +0200)
Lock dq_dqb_lock around dquot_decr_inodes()

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Fixes: 7b9ca4c61bc2 ("quota: Reduce contention on dq_data_lock")
Signed-off-by: Jan Kara <jack@suse.cz>
fs/quota/dquot.c

index 8381db9db6d9bcc3acfa645bf9f73cbb5933c564..50b0556a124f2508531ce9e6fc61721aeb179cc8 100644 (file)
@@ -1980,7 +1980,9 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
                ret = dquot_add_space(transfer_to[cnt], cur_space, rsv_space, 0,
                                      &warn_to[cnt]);
                if (ret) {
+                       spin_lock(&transfer_to[cnt]->dq_dqb_lock);
                        dquot_decr_inodes(transfer_to[cnt], inode_usage);
+                       spin_unlock(&transfer_to[cnt]->dq_dqb_lock);
                        goto over_quota;
                }
        }