quota: Push dqio_sem down to ->write_dqblk()
[sfrench/cifs-2.6.git] / fs / quota / quota_v2.c
index b2cd34f6b3da8bb17a6fdfe1d10018250b5f162b..482733abe4ac9ca2cd4adc7ec38dc042eb2dd3bf 100644 (file)
@@ -298,7 +298,15 @@ static int v2_read_dquot(struct dquot *dquot)
 
 static int v2_write_dquot(struct dquot *dquot)
 {
-       return qtree_write_dquot(sb_dqinfo(dquot->dq_sb, dquot->dq_id.type)->dqi_priv, dquot);
+       struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
+       int ret;
+
+       down_write(&dqopt->dqio_sem);
+       ret = qtree_write_dquot(
+                       sb_dqinfo(dquot->dq_sb, dquot->dq_id.type)->dqi_priv,
+                       dquot);
+       up_write(&dqopt->dqio_sem);
+       return ret;
 }
 
 static int v2_release_dquot(struct dquot *dquot)