Skip to content

Commit 8e2e0a7

Browse files
chaseyujankara
authored andcommitted
quota: fix to propagate error of mark_dquot_dirty() to caller
in order to let caller be aware of failure of mark_dquot_dirty(). Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jan Kara <[email protected]> Message-Id: <[email protected]>
1 parent 4f8cf60 commit 8e2e0a7

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

fs/quota/dquot.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ static inline int mark_all_dquot_dirty(struct dquot __rcu * const *dquots)
410410
if (dquot)
411411
/* Even in case of error we have to continue */
412412
ret = mark_dquot_dirty(dquot);
413-
if (!err)
413+
if (!err && ret < 0)
414414
err = ret;
415415
}
416416
return err;
@@ -1737,7 +1737,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
17371737

17381738
if (reserve)
17391739
goto out_flush_warn;
1740-
mark_all_dquot_dirty(dquots);
1740+
ret = mark_all_dquot_dirty(dquots);
17411741
out_flush_warn:
17421742
srcu_read_unlock(&dquot_srcu, index);
17431743
flush_warnings(warn);
@@ -1786,7 +1786,7 @@ int dquot_alloc_inode(struct inode *inode)
17861786
warn_put_all:
17871787
spin_unlock(&inode->i_lock);
17881788
if (ret == 0)
1789-
mark_all_dquot_dirty(dquots);
1789+
ret = mark_all_dquot_dirty(dquots);
17901790
srcu_read_unlock(&dquot_srcu, index);
17911791
flush_warnings(warn);
17921792
return ret;
@@ -1990,7 +1990,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
19901990
qsize_t inode_usage = 1;
19911991
struct dquot __rcu **dquots;
19921992
struct dquot *transfer_from[MAXQUOTAS] = {};
1993-
int cnt, index, ret = 0;
1993+
int cnt, index, ret = 0, err;
19941994
char is_valid[MAXQUOTAS] = {};
19951995
struct dquot_warn warn_to[MAXQUOTAS];
19961996
struct dquot_warn warn_from_inodes[MAXQUOTAS];
@@ -2087,8 +2087,12 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
20872087
* mark_all_dquot_dirty().
20882088
*/
20892089
index = srcu_read_lock(&dquot_srcu);
2090-
mark_all_dquot_dirty((struct dquot __rcu **)transfer_from);
2091-
mark_all_dquot_dirty((struct dquot __rcu **)transfer_to);
2090+
err = mark_all_dquot_dirty((struct dquot __rcu **)transfer_from);
2091+
if (err < 0)
2092+
ret = err;
2093+
err = mark_all_dquot_dirty((struct dquot __rcu **)transfer_to);
2094+
if (err < 0)
2095+
ret = err;
20922096
srcu_read_unlock(&dquot_srcu, index);
20932097

20942098
flush_warnings(warn_to);
@@ -2098,7 +2102,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)
20982102
for (cnt = 0; cnt < MAXQUOTAS; cnt++)
20992103
if (is_valid[cnt])
21002104
transfer_to[cnt] = transfer_from[cnt];
2101-
return 0;
2105+
return ret;
21022106
over_quota:
21032107
/* Back out changes we already did */
21042108
for (cnt--; cnt >= 0; cnt--) {
@@ -2726,6 +2730,7 @@ static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di)
27262730
struct mem_dqblk *dm = &dquot->dq_dqb;
27272731
int check_blim = 0, check_ilim = 0;
27282732
struct mem_dqinfo *dqi = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_id.type];
2733+
int ret;
27292734

27302735
if (di->d_fieldmask & ~VFS_QC_MASK)
27312736
return -EINVAL;
@@ -2807,8 +2812,9 @@ static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di)
28072812
else
28082813
set_bit(DQ_FAKE_B, &dquot->dq_flags);
28092814
spin_unlock(&dquot->dq_dqb_lock);
2810-
mark_dquot_dirty(dquot);
2811-
2815+
ret = mark_dquot_dirty(dquot);
2816+
if (ret < 0)
2817+
return ret;
28122818
return 0;
28132819
}
28142820

0 commit comments

Comments
 (0)