aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2018-03-28 10:19:22 -0700
committerGitHub <[email protected]>2018-03-28 10:19:22 -0700
commitb2ab468dded24a090dba9fc8396b3d394011ce14 (patch)
tree52ce015e474ee028851256f3b423075b7cf73f58 /module/zfs
parent668173b5764386b47de0beb7c57ff8ce8f68f983 (diff)
Fix mmap / libaio deadlock
Calling uiomove() in mappedread() under the page lock can result in a deadlock if the user space page needs to be faulted in. Resolve the issue by dropping the page lock before the uiomove(). The inode range lock protects against concurrent updates via zfs_read() and zfs_write(). Reviewed-by: Albert Lee <[email protected]> Reviewed-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #7335 Closes #7339
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/zfs_vnops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index a2d7d7b24..14caa80e5 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -400,6 +400,7 @@ mappedread(struct inode *ip, int nbytes, uio_t *uio)
pp = find_lock_page(mp, start >> PAGE_SHIFT);
if (pp) {
ASSERT(PageUptodate(pp));
+ unlock_page(pp);
pb = kmap(pp);
error = uiomove(pb + off, bytes, UIO_READ, uio);
@@ -409,7 +410,6 @@ mappedread(struct inode *ip, int nbytes, uio_t *uio)
flush_dcache_page(pp);
mark_page_accessed(pp);
- unlock_page(pp);
put_page(pp);
} else {
error = dmu_read_uio_dbuf(sa_get_db(zp->z_sa_hdl),