]> git.baikalelectronics.ru Git - kernel.git/commit
gfs2: Return more useful errors from gfs2_rgrp_send_discards()
authorAndrew Price <anprice@redhat.com>
Tue, 22 Mar 2022 18:49:19 +0000 (18:49 +0000)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 24 May 2022 19:29:14 +0000 (21:29 +0200)
commit106d6f176ca90a06957a0a33e3c3b6a67cc13b02
tree5d96864510cdfc4c14bf173c012dbf1ff27b25c1
parentd80adc0a81857a74c2b0a655ebad72a6d659ac77
gfs2: Return more useful errors from gfs2_rgrp_send_discards()

The bug that 37c4864d8 ("gfs2: Make sure FITRIM minlen is rounded up to
fs block size") fixes was a little confusing as the user saw
"Input/output error" which masked the -EINVAL that sb_issue_discard()
returned.

sb_issue_discard() can fail for various reasons, so we should return its
return value from gfs2_rgrp_send_discards() to avoid all errors being
reported as IO errors.

This improves error reporting for FITRIM and makes no difference to the
-o discard code path because the return value from
gfs2_rgrp_send_discards() gets thrown away in that case (and the option
switches off). Presumably that's why it was ok to just return -EIO in
the past, before FITRIM was implemented.

Tested with xfstests.

Signed-off-by: Andrew Price <anprice@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/rgrp.c