Skip to content

Commit 36cebab

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: don't treat all radix_tree_insert errors as -EEXIST
Return other errors to the caller instead. Note that there really shouldn't be any other errors because the entry is preallocated, but if there were, we'd better return them instead of retrying forever. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent 005d5ae commit 36cebab

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

fs/xfs/xfs_dquot.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,6 @@ xfs_qm_dqget_cache_insert(
860860
mutex_lock(&qi->qi_tree_lock);
861861
error = radix_tree_insert(tree, id, dqp);
862862
if (unlikely(error)) {
863-
/* Duplicate found! Caller must try again. */
864863
trace_xfs_dqget_dup(dqp);
865864
goto out_unlock;
866865
}
@@ -935,13 +934,16 @@ xfs_qm_dqget(
935934

936935
error = xfs_qm_dqget_cache_insert(mp, qi, tree, id, dqp);
937936
if (error) {
938-
/*
939-
* Duplicate found. Just throw away the new dquot and start
940-
* over.
941-
*/
942937
xfs_qm_dqdestroy(dqp);
943-
XFS_STATS_INC(mp, xs_qm_dquot_dups);
944-
goto restart;
938+
if (error == -EEXIST) {
939+
/*
940+
* Duplicate found. Just throw away the new dquot and
941+
* start over.
942+
*/
943+
XFS_STATS_INC(mp, xs_qm_dquot_dups);
944+
goto restart;
945+
}
946+
return error;
945947
}
946948

947949
trace_xfs_dqget_miss(dqp);
@@ -1060,13 +1062,16 @@ xfs_qm_dqget_inode(
10601062

10611063
error = xfs_qm_dqget_cache_insert(mp, qi, tree, id, dqp);
10621064
if (error) {
1063-
/*
1064-
* Duplicate found. Just throw away the new dquot and start
1065-
* over.
1066-
*/
10671065
xfs_qm_dqdestroy(dqp);
1068-
XFS_STATS_INC(mp, xs_qm_dquot_dups);
1069-
goto restart;
1066+
if (error == -EEXIST) {
1067+
/*
1068+
* Duplicate found. Just throw away the new dquot and
1069+
* start over.
1070+
*/
1071+
XFS_STATS_INC(mp, xs_qm_dquot_dups);
1072+
goto restart;
1073+
}
1074+
return error;
10701075
}
10711076

10721077
dqret:

0 commit comments

Comments
 (0)