diff options
author | Jan Kara <jack@suse.cz> | 2017-06-08 15:48:16 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2017-08-17 19:03:09 +0200 |
commit | 8fc32c2b0db2c9ee0dffebea65bcdea03a29ba5a (patch) | |
tree | 1ad92b623f562ac9f160fb4ea8e4c9073d2cb4f5 /fs/quota/dquot.c | |
parent | 47cdc11deed639ae1d4050efbc284d328c3c2fa5 (diff) |
quota: Push dqio_sem down to ->write_dqblk()
Push down acquisition of dqio_sem into ->write_dqblk() callback. It will
allow quota formats to decide whether they need it or not.
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota/dquot.c')
-rw-r--r-- | fs/quota/dquot.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 46046523abf0..562f5978488f 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -412,14 +412,14 @@ int dquot_acquire(struct dquot *dquot) set_bit(DQ_READ_B, &dquot->dq_flags); /* Instantiate dquot if needed */ if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && !dquot->dq_off) { - down_write(&dqopt->dqio_sem); ret = dqopt->ops[dquot->dq_id.type]->commit_dqblk(dquot); /* Write the info if needed */ if (info_dirty(&dqopt->info[dquot->dq_id.type])) { + down_write(&dqopt->dqio_sem); ret2 = dqopt->ops[dquot->dq_id.type]->write_file_info( dquot->dq_sb, dquot->dq_id.type); + up_write(&dqopt->dqio_sem); } - up_write(&dqopt->dqio_sem); if (ret < 0) goto out_iolock; if (ret2 < 0) { @@ -456,13 +456,10 @@ int dquot_commit(struct dquot *dquot) spin_unlock(&dq_list_lock); /* Inactive dquot can be only if there was error during read/init * => we have better not writing it */ - if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { - down_write(&dqopt->dqio_sem); + if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) ret = dqopt->ops[dquot->dq_id.type]->commit_dqblk(dquot); - up_write(&dqopt->dqio_sem); - } else { + else ret = -EIO; - } out_lock: mutex_unlock(&dquot->dq_lock); return ret; |