On 3/20/26 23:39, Lorenzo Stoakes (Oracle) wrote: > The f_op->mmap interface is deprecated, so update uio_info to use its > successor, mmap_prepare. > > Therefore, replace the uio_info->mmap hook with a new > uio_info->mmap_prepare hook, and update its one user, target_core_user, > to both specify this new mmap_prepare hook and also to use the new > vm_ops->mapped() hook to continue to maintain a correct udev->kref > refcount. > > Then update uio_mmap() to utilise the mmap_prepare compatibility layer to > invoke this callback from the uio mmap invocation. > > Signed-off-by: Lorenzo Stoakes (Oracle) <[email protected]>
Acked-by: Vlastimil Babka (SUSE) <[email protected]> > --- > drivers/target/target_core_user.c | 26 ++++++++++++++++++-------- > drivers/uio/uio.c | 10 ++++++++-- > include/linux/uio_driver.h | 4 ++-- > 3 files changed, 28 insertions(+), 12 deletions(-) > > diff --git a/drivers/target/target_core_user.c > b/drivers/target/target_core_user.c > index af95531ddd35..edc2afd5f4ee 100644 > --- a/drivers/target/target_core_user.c > +++ b/drivers/target/target_core_user.c > @@ -1860,6 +1860,17 @@ static struct page *tcmu_try_get_data_page(struct > tcmu_dev *udev, uint32_t dpi) > return NULL; > } > > +static int tcmu_vma_mapped(unsigned long start, unsigned long end, pgoff_t > pgoff, > + const struct file *file, void **vm_private_data) > +{ > + struct tcmu_dev *udev = *vm_private_data; > + > + pr_debug("vma_mapped\n"); This looked like testing leftover at first, but it matches tcmu_vma_open()/close() (in case anyone else wonders). > + > + kref_get(&udev->kref); > + return 0; > +} > +

