Skip to contentSkip to conversation

gfs2: Return more useful errors from gfs2_rgrp_send_discards()

PATCH Superseded Andrew Price 1 participant 1 message Mar 23, 2022 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gfs2: Return more useful errors from gfs2_rgrp_send_discards()

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

---

(As far as I can tell there are no limitations on which errno's can be set by ioctl(FITRIM) )

 fs/gfs2/rgrp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/gfs2/rgrp.c +2 -2
index 0fb3c01bc557..58f791ed7139 100644
@@ -1313,7 +1313,7 @@ int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
 	u64 blk;
 	sector_t start = 0;
 	sector_t nr_blks = 0;
-	int rv;
+	int rv = -EIO;
 	unsigned int x;
 	u32 trimmed = 0;
 	u8 diff;
@@ -1369,7 +1369,7 @@ int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
 	if (sdp->sd_args.ar_discard)
 		fs_warn(sdp, "error %d on discard request, turning discards off for this filesystem\n", rv);
 	sdp->sd_args.ar_discard = 0;
-	return -EIO;
+	return rv;
 }
 
 /**
Signature · 1 line
2.35.1