[Devel] [PATCH RH8 1/8] ploop: Read metadata page-aligned

Kirill Tkhai ktkhai at virtuozzo.com
Thu Jul 1 18:14:20 MSK 2021


File open with O_DIRECT results in direct read,
even if we do that synchronous from kernel.

iov_iter_get_pages()

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-bat.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-ploop-bat.c b/drivers/md/dm-ploop-bat.c
index f55956aab5a7..90ddba88494f 100644
--- a/drivers/md/dm-ploop-bat.c
+++ b/drivers/md/dm-ploop-bat.c
@@ -369,6 +369,7 @@ int ploop_read_delta_metadata(struct ploop *ploop, struct file *file,
 	int ret;
 
 	size = (PLOOP_MAP_OFFSET + ploop->nr_bat_entries) * sizeof(map_index_t);
+	size = ALIGN(size, PAGE_SIZE); /* file may be open as direct */
 	*d_hdr = vzalloc(size);
 	if (!*d_hdr) {
 		ret = -ENOMEM;




More information about the Devel mailing list