Skip to content

Commit cea4403

Browse files
author
Andreas Gruenbacher
committed
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. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 6fa0a72 commit cea4403

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

fs/gfs2/aops.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,16 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos,
491491
void *p;
492492

493493
do {
494-
amt = size - copied;
495-
if (offset + size > PAGE_SIZE)
496-
amt = PAGE_SIZE - offset;
497494
page = read_cache_page(mapping, index, gfs2_read_folio, NULL);
498-
if (IS_ERR(page))
495+
if (IS_ERR(page)) {
496+
if (PTR_ERR(page) == -EINTR)
497+
continue;
499498
return PTR_ERR(page);
499+
}
500500
p = kmap_atomic(page);
501+
amt = size - copied;
502+
if (offset + size > PAGE_SIZE)
503+
amt = PAGE_SIZE - offset;
501504
memcpy(buf + copied, p + offset, amt);
502505
kunmap_atomic(p);
503506
put_page(page);

0 commit comments

Comments
 (0)