Skip to contentSkip to conversation

gfs2: retry interrupted internal reads

PATCH New Andreas Gruenbacher 1 participant 1 message Jun 13, 2023 GFS2 file system

lore
Share & tools
lore

Andreas Gruenbacher

author maintainer
#0 lore raw

PATCH 1/1 gfs2: retry interrupted internal reads

The iomap-based read operations done by gfs2 for its system files, such
as rindex, may sometimes be interrupted and return -EINTR. This
confuses some users of gfs2_internal_read(). Fix that by retrying interrupted reads.

---
 fs/gfs2/aops.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
fs/gfs2/aops.c +7 -4
index d95125714ebb..dacc21b1ae00 100644
@@ -491,13 +491,16 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos,
 	void *p;
 
 	do {
-		amt = size - copied;
-		if (offset + size > PAGE_SIZE)
-			amt = PAGE_SIZE - offset;
 		page = read_cache_page(mapping, index, gfs2_read_folio, NULL);
-		if (IS_ERR(page))
+		if (IS_ERR(page)) {
+			if (PTR_ERR(page) == -EINTR)
+				continue;
 			return PTR_ERR(page);
+		}
 		p = kmap_atomic(page);
+		amt = size - copied;
+		if (offset + size > PAGE_SIZE)
+			amt = PAGE_SIZE - offset;
 		memcpy(buf + copied, p + offset, amt);
 		kunmap_atomic(p);
 		put_page(page);
Signature · 1 line
2.40.0