mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Fix regression in dmu_buf_will_fill()
Direct I/O implementation added condition to call dbuf_undirty() only in case of block cloning. But the condition is not right if the block is no longer dirty in this TXG, but still in DB_NOFILL state. It resulted in block not reverting to DB_UNCACHED and following NULL de-reference on attempt to access absent db_data. While there, add assertions for db_data to make debugging easier. Reviewed-by: Brian Atkinson <batkinson@lanl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #16829
This commit is contained in:
committed by
Brian Behlendorf
parent
17cdb7a2b1
commit
b17ea73f9d
@@ -103,6 +103,7 @@ dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, uint64_t size,
|
||||
db->db_offset + bufoff);
|
||||
thiscpy = MIN(PAGESIZE, tocpy - copied);
|
||||
va = zfs_map_page(*ma, &sf);
|
||||
ASSERT(db->db_data != NULL);
|
||||
memcpy((char *)db->db_data + bufoff, va, thiscpy);
|
||||
zfs_unmap_page(sf);
|
||||
ma += 1;
|
||||
@@ -172,6 +173,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
|
||||
ASSERT3U(db->db_size, >, PAGE_SIZE);
|
||||
bufoff = IDX_TO_OFF(m->pindex) % db->db_size;
|
||||
va = zfs_map_page(m, &sf);
|
||||
ASSERT(db->db_data != NULL);
|
||||
memcpy(va, (char *)db->db_data + bufoff, PAGESIZE);
|
||||
zfs_unmap_page(sf);
|
||||
vm_page_valid(m);
|
||||
@@ -211,8 +213,10 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
|
||||
*/
|
||||
tocpy = MIN(db->db_size - bufoff, PAGESIZE - pgoff);
|
||||
ASSERT3S(tocpy, >=, 0);
|
||||
if (m != bogus_page)
|
||||
if (m != bogus_page) {
|
||||
ASSERT(db->db_data != NULL);
|
||||
memcpy(va + pgoff, (char *)db->db_data + bufoff, tocpy);
|
||||
}
|
||||
|
||||
pgoff += tocpy;
|
||||
ASSERT3S(pgoff, >=, 0);
|
||||
@@ -290,6 +294,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
|
||||
bufoff = IDX_TO_OFF(m->pindex) % db->db_size;
|
||||
tocpy = MIN(db->db_size - bufoff, PAGESIZE);
|
||||
va = zfs_map_page(m, &sf);
|
||||
ASSERT(db->db_data != NULL);
|
||||
memcpy(va, (char *)db->db_data + bufoff, tocpy);
|
||||
if (tocpy < PAGESIZE) {
|
||||
ASSERT3S(i, ==, *rahead - 1);
|
||||
|
||||
Reference in New Issue
Block a user