Re: [PATCH 07/12] vhost-scsi: convert put_page() to put_user_page*()

From: John Hubbard
Date: Wed Jul 24 2019 - 00:35:01 EST


On 7/23/19 9:25 PM, john.hubbard@xxxxxxxxx wrote:
> From: JÃrÃme Glisse <jglisse@xxxxxxxxxx>
>
> For pages that were retained via get_user_pages*(), release those pages
> via the new put_user_page*() routines, instead of via put_page().
>
> This is part a tree-wide conversion, as described in commit fc1d8e7cca2d
> ("mm: introduce put_user_page*(), placeholder versions").
>
> Changes from JÃrÃme's original patch:
>
> * Changed a WARN_ON to a BUG_ON.
>

Clearly, the above commit log has it backwards (this is quite my night
for typos). Please read that as "changed a BUG_ON to a WARN_ON".

I'll correct the commit description in next iteration of this patchset.

...

> + /*
> + * Here in all cases we should have an IOVEC which use GUP. If that is
> + * not the case then we will wrongly call put_user_page() and the page
> + * refcount will go wrong (this is in vhost_scsi_release_cmd())
> + */
> + WARN_ON(!iov_iter_get_pages_use_gup(iter));
> +
...

thanks,
--
John Hubbard
NVIDIA