Re: [Cluster-devel] [RFC 4/9] gfs2: Fix mmap + page fault deadlocks (part 1)

2021-06-12 Thread Al Viro
On Fri, Jun 11, 2021 at 04:25:10PM +, Al Viro wrote: > On Wed, Jun 02, 2021 at 01:16:32PM +0200, Andreas Gruenbacher wrote: > > > Well, iomap_file_buffered_write() does that by using > > iov_iter_fault_in_readable() and iov_iter_copy_from_user_atomic() as > > in iomap_write_actor(), but the re

Re: [Cluster-devel] [RFC 5/9] iov_iter: Add iov_iter_fault_in_writeable()

2021-06-12 Thread Al Viro
On Mon, May 31, 2021 at 05:12:31PM +, Al Viro wrote: > > +int iov_iter_fault_in_writeable(struct iov_iter *i, size_t bytes) > > +{ > > + size_t skip = i->iov_offset; > > + const struct iovec *iov; > > + int err; > > + struct iovec v; > > + > > + if (!(i->type & (ITER_BVEC|ITER_KVEC))

Re: [Cluster-devel] [RFC 4/9] gfs2: Fix mmap + page fault deadlocks (part 1)

2021-06-12 Thread Al Viro
On Sat, Jun 12, 2021 at 09:05:40PM +, Al Viro wrote: > Is the above an accurate description of the mainline situation there? > In particular, normal read doesn't seem to bother with locks at all. > What exactly are those cluster locks for in O_DIRECT read? BTW, assuming the lack of contention

Re: [Cluster-devel] [RFC 5/9] iov_iter: Add iov_iter_fault_in_writeable()

2021-06-12 Thread Linus Torvalds
On Sat, Jun 12, 2021 at 2:12 PM Al Viro wrote: > > Actually, is there any good way to make sure that write fault is triggered > _without_ modification of the data? On x86 lock xadd (of 0, that is) would > probably do it and some of the other architectures could probably get away > with using cmpx

Re: [Cluster-devel] [RFC 5/9] iov_iter: Add iov_iter_fault_in_writeable()

2021-06-12 Thread Al Viro
On Sat, Jun 12, 2021 at 02:33:31PM -0700, Linus Torvalds wrote: > That said, reads are obviously much easier, and I'd probably prefer > the model for writes to be to not necessarily pre-fault anything at > all, but just write to user space with page faults disabled. *nod* I don't like that write

Re: [Cluster-devel] [RFC 5/9] iov_iter: Add iov_iter_fault_in_writeable()

2021-06-12 Thread Linus Torvalds
On Sat, Jun 12, 2021 at 2:47 PM Al Viro wrote: > > O_DIRECT case is a PITA - there we use GUP and there's no way > to tell GUP that in the current situation we do *NOT* want to hit > ->fault()/->page_mkwrite()/etc. pagefault_disable() won't be even > noticed there... Well, we could chang

Re: [Cluster-devel] [RFC 5/9] iov_iter: Add iov_iter_fault_in_writeable()

2021-06-12 Thread Al Viro
On Sat, Jun 12, 2021 at 04:17:30PM -0700, Linus Torvalds wrote: > On Sat, Jun 12, 2021 at 2:47 PM Al Viro wrote: > > > > O_DIRECT case is a PITA - there we use GUP and there's no way > > to tell GUP that in the current situation we do *NOT* want to hit > > ->fault()/->page_mkwrite()/etc.