Skip to content

Commit 9480b4e

Browse files
Matthew Wilcox (Oracle)torvalds
authored andcommitted
cachefiles: Handle readpage error correctly
If ->readpage returns an error, it has already unlocked the page. Fixes: 5e929b3 ("CacheFiles: Handle truncate unlocking the page we're reading") Cc: stable@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7e2b2da commit 9480b4e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/cachefiles/rdwr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static int cachefiles_read_reissue(struct cachefiles_object *object,
121121
_debug("reissue read");
122122
ret = bmapping->a_ops->readpage(NULL, backpage);
123123
if (ret < 0)
124-
goto unlock_discard;
124+
goto discard;
125125
}
126126

127127
/* but the page may have been read before the monitor was installed, so
@@ -138,6 +138,7 @@ static int cachefiles_read_reissue(struct cachefiles_object *object,
138138

139139
unlock_discard:
140140
unlock_page(backpage);
141+
discard:
141142
spin_lock_irq(&object->work_lock);
142143
list_del(&monitor->op_link);
143144
spin_unlock_irq(&object->work_lock);

0 commit comments

Comments
 (0)