Commit 08e9cbe
scsi: st: Convert convert get_user_pages() --> pin_user_pages()
This code was using get_user_pages*(), in a "Case 1" scenario (Direct IO),
using the categorization from [1]. That means that it's time to convert the
get_user_pages*() + put_page() calls to pin_user_pages*() +
unpin_user_pages() calls.
There is some helpful background in [2]: basically, this is a small part of
fixing a long-standing disconnect between pinning pages, and file systems'
use of those pages.
Note that this effectively changes the code's behavior as well: it now
ultimately calls set_page_dirty_lock(), instead of SetPageDirty().This is
probably more accurate.
As Christoph Hellwig put it, "set_page_dirty() is only safe if we are
dealing with a file backed page where we have reference on the inode it
hangs off." [3]
Also, this deletes one of the two FIXME comments (about refcounting),
because there is nothing wrong with the refcounting at this point.
[1] Documentation/core-api/pin_user_pages.rst
[2] "Explicit pinning of user-space pages":
https://lwn.net/Articles/807108/
[3] https://lore.kernel.org/r/20190723153640.GB720@lst.de
Link: https://lore.kernel.org/r/20200526182709.99599-1-jhubbard@nvidia.com
Cc: "Kai Mäkisara (Kolumbus)" <kai.makisara@kolumbus.fi>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: James E.J. Bottomley <jejb@linux.ibm.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>1 parent 987db58 commit 08e9cbe
1 file changed
Lines changed: 5 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4921 | 4921 | | |
4922 | 4922 | | |
4923 | 4923 | | |
4924 | | - | |
| 4924 | + | |
4925 | 4925 | | |
4926 | 4926 | | |
4927 | 4927 | | |
| |||
4943 | 4943 | | |
4944 | 4944 | | |
4945 | 4945 | | |
4946 | | - | |
| 4946 | + | |
4947 | 4947 | | |
4948 | 4948 | | |
4949 | 4949 | | |
| |||
4963 | 4963 | | |
4964 | 4964 | | |
4965 | 4965 | | |
4966 | | - | |
4967 | | - | |
| 4966 | + | |
4968 | 4967 | | |
4969 | 4968 | | |
4970 | 4969 | | |
| |||
4976 | 4975 | | |
4977 | 4976 | | |
4978 | 4977 | | |
4979 | | - | |
4980 | | - | |
4981 | | - | |
4982 | | - | |
| 4978 | + | |
| 4979 | + | |
4983 | 4980 | | |
4984 | | - | |
4985 | | - | |
4986 | | - | |
4987 | | - | |
4988 | | - | |
4989 | | - | |
4990 | | - | |
4991 | 4981 | | |
4992 | 4982 | | |
4993 | 4983 | | |
| |||
0 commit comments