Backported from master. Signed-off-by: Rosen Penev <rosenp@gmail.com>
Backported upstream patch. Signed-off-by: Rosen Penev <rosenp@gmail.com>