Re: [PATCH v11 2/8] iov_iter: Add a function to extract a page list from an iterator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 26, 2023 at 09:59:36PM +0000, Al Viro wrote:
> On Thu, Jan 26, 2023 at 02:16:20PM +0000, David Howells wrote:
> 
> > +/**
> > + * iov_iter_extract_will_pin - Indicate how pages from the iterator will be retained
> > + * @iter: The iterator
> > + *
> > + * Examine the iterator and indicate by returning true or false as to how, if
> > + * at all, pages extracted from the iterator will be retained by the extraction
> > + * function.
> > + *
> > + * %true indicates that the pages will have a pin placed in them that the
> > + * caller must unpin.  This is must be done for DMA/async DIO to force fork()
> > + * to forcibly copy a page for the child (the parent must retain the original
> > + * page).
> > + *
> > + * %false indicates that no measures are taken and that it's up to the caller
> > + * to retain the pages.
> > + */
> > +static inline bool iov_iter_extract_will_pin(const struct iov_iter *iter)
> > +{
> > +	return user_backed_iter(iter);
> > +}
> > +
> 
> Wait a sec; why would we want a pin for pages we won't be modifying?
> A reference - sure, but...

After having looked through the earlier iterations of the patchset -
sorry, but that won't fly for (at least) vmsplice().  There we can't
pin those suckers; thankfully, we don't need to - they are used only
for fetches, so FOLL_GET is sufficient.  With your "we'll just pin them,
source or destination" you won't be able to convert at least that
call of iov_iter_get_pages2().  And there might be other similar cases;
I won't swear there's more, but ISTR running into more than one of
the "pin won't be OK here, but fortunately it's a data source" places.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux