Commit d2faa415 authored by Jan Kara's avatar Jan Kara

quota: Do not acquire dqio_sem for dquot overwrites in v2 format

When dquot has space already allocated in a quota file, we just
overwrite that place when writing dquot. So we don't need any protection
against other modifications of quota file as these keep dquot in place.
Reviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 8fc32c2b
...@@ -300,11 +300,22 @@ static int v2_write_dquot(struct dquot *dquot) ...@@ -300,11 +300,22 @@ static int v2_write_dquot(struct dquot *dquot)
{ {
struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
int ret; int ret;
bool alloc = false;
/*
* If space for dquot is already allocated, we don't need any
* protection as we'll only overwrite the place of dquot. We are
* still protected by concurrent writes of the same dquot by
* dquot->dq_lock.
*/
if (!dquot->dq_off) {
alloc = true;
down_write(&dqopt->dqio_sem); down_write(&dqopt->dqio_sem);
}
ret = qtree_write_dquot( ret = qtree_write_dquot(
sb_dqinfo(dquot->dq_sb, dquot->dq_id.type)->dqi_priv, sb_dqinfo(dquot->dq_sb, dquot->dq_id.type)->dqi_priv,
dquot); dquot);
if (alloc)
up_write(&dqopt->dqio_sem); up_write(&dqopt->dqio_sem);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment