diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-11-29 03:19:07 -0500 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2010-12-09 08:39:17 -0500 |
commit | 3bf9be40ff76b6df136f14a497167c116b2b3c53 (patch) | |
tree | 27b8f715ea2de959bb0c06ff9b99e408a0942182 /drivers/vhost | |
parent | a290aec88a9c4747353ea7aa9b2569bd61297c3c (diff) |
vhost: correctly set bits of dirty pages
Fix two bugs in dirty page logging:
When counting pages we should increase address by 1 instead of
VHOST_PAGE_SIZE. Make log_write() correctly process requests
that cross pages with write_address not starting at page boundary.
Reported-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/vhost.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 916cdbc279e0..4c256d15c249 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -885,6 +885,7 @@ static int log_write(void __user *log_base, | |||
885 | int r; | 885 | int r; |
886 | if (!write_length) | 886 | if (!write_length) |
887 | return 0; | 887 | return 0; |
888 | write_length += write_address % VHOST_PAGE_SIZE; | ||
888 | write_address /= VHOST_PAGE_SIZE; | 889 | write_address /= VHOST_PAGE_SIZE; |
889 | for (;;) { | 890 | for (;;) { |
890 | u64 base = (u64)(unsigned long)log_base; | 891 | u64 base = (u64)(unsigned long)log_base; |
@@ -898,7 +899,7 @@ static int log_write(void __user *log_base, | |||
898 | if (write_length <= VHOST_PAGE_SIZE) | 899 | if (write_length <= VHOST_PAGE_SIZE) |
899 | break; | 900 | break; |
900 | write_length -= VHOST_PAGE_SIZE; | 901 | write_length -= VHOST_PAGE_SIZE; |
901 | write_address += VHOST_PAGE_SIZE; | 902 | write_address += 1; |
902 | } | 903 | } |
903 | return r; | 904 | return r; |
904 | } | 905 | } |