[Cluster-devel] [PATCH v5 06/12] gfs2: Add wrapper for iomap_file_buffered_write

2021-08-03 Thread Andreas Gruenbacher
Add a wrapper around iomap_file_buffered_write. We'll add code for when the operation needs to be retried here later. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/f

[Cluster-devel] [PATCH v5 05/12] iov_iter: Introduce fault_in_iov_iter_writeable

2021-08-03 Thread Andreas Gruenbacher
e iterator passed to .read_iter isn't in memory. Signed-off-by: Andreas Gruenbacher --- include/linux/pagemap.h | 1 + include/linux/uio.h | 1 + lib/iov_iter.c | 41 +++ mm/gup.c| 61 + 4 files changed,

[Cluster-devel] [PATCH v5 02/12] powerpc/kvm: Fix kvm_use_magic_page

2021-08-03 Thread Andreas Gruenbacher
When switching from __get_user to fault_in_pages_readable, commit 9f9eae5ce717 broke kvm_use_magic_page: fault_in_pages_readable returns 0 on success. Fix that. Fixes: 9f9eae5ce717 ("powerpc/kvm: Prefer fault_in_pages_readable function") Cc: sta...@vger.kernel.org # v4.18+ Signed-off-b

[Cluster-devel] [PATCH v5 01/12] iov_iter: Fix iov_iter_get_pages{, _alloc} page fault return value

2021-08-03 Thread Andreas Gruenbacher
tive value. Fix both functions. In addition, change iov_iter_get_pages_alloc to return NULL in that case to prevent resource leaks. It seems that the cifs and nfs filesystems don't handle the zero case very well. Could the maintainers please have a look? Signed-off-by: Andreas Gruenb

[Cluster-devel] [PATCH v5 04/12] Turn iov_iter_fault_in_readable into fault_in_iov_iter_readable

2021-08-03 Thread Andreas Gruenbacher
py if any pages can be faulted in. Rename iov_iter_fault_in_readable to an unfortunately clumsy fault_in_iov_iter_readable to make sure that code that uses it can be fixed instead of breaking silently. Fix up the existing users. Signed-off-by: Andreas Gruenbacher --- fs/btrfs/file.c

[Cluster-devel] [PATCH v5 00/12] gfs2: Fix mmap + page fault deadlocks

2021-08-03 Thread Andreas Gruenbacher
safely allowing that, but more work remains to be done. For immediate consideration by Al Viro: iov_iter: Fix iov_iter_get_pages{,_alloc} page fault return value For immediate consideration by Paul Mackerras: powerpc/kvm: Fix kvm_use_magic_page Thanks, Andreas Andreas Gruenbacher (12)

[Cluster-devel] [PATCH v5 03/12] Turn fault_in_pages_{readable, writeable} into fault_in_{readable, writeable}

2021-08-03 Thread Andreas Gruenbacher
Signed-off-by: Andreas Gruenbacher --- arch/powerpc/kernel/kvm.c | 3 +- arch/powerpc/kernel/signal_32.c | 4 +- arch/powerpc/kernel/signal_64.c | 2 +- arch/x86/kernel/fpu/signal.c| 8 ++-- drivers/gpu/drm/armada/armada_gem.c | 7 ++-- fs/btrfs/ioctl.c

[Cluster-devel] [PATCH] gfs2: iomap inline data handling cleanup

2021-07-31 Thread Andreas Gruenbacher
ghtly tidy up the error handling. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/bmap.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index ed8b67b21718..84ad0fe787ea 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -866,12 +8

Re: [Cluster-devel] [GFS2 PATCH 13/15] gfs2: ignore usr|grp|prjquota mount options

2021-07-28 Thread Andreas Gruenbacher
On Wed, Jul 28, 2021 at 10:33 PM Bob Peterson wrote: > On 7/28/21 1:28 PM, Andreas Gruenbacher wrote: > > On Tue, Jul 27, 2021 at 7:37 PM Bob Peterson wrote: > >> Before this patch, gfs2 rejected mounts attempted with the usrquota, > >> grpquota, or prjquota mount op

Re: [Cluster-devel] [GFS2 PATCH 13/15] gfs2: ignore usr|grp|prjquota mount options

2021-07-28 Thread Andreas Gruenbacher
On Tue, Jul 27, 2021 at 7:37 PM Bob Peterson wrote: > Before this patch, gfs2 rejected mounts attempted with the usrquota, > grpquota, or prjquota mount options. That caused numerous xfstests tests > to fail. This patch allows gfs2 to accept but ignore those mount options > so the tests may be run

Re: [Cluster-devel] [GFS2 PATCH 10/10] gfs2: replace sd_aspace with sd_inode

2021-07-27 Thread Andreas Gruenbacher
On Tue, Jul 13, 2021 at 9:34 PM Bob Peterson wrote: > On 7/13/21 1:26 PM, Steven Whitehouse wrote: > > Hi, > > On Tue, 2021-07-13 at 13:09 -0500, Bob Peterson wrote: > > Before this patch, gfs2 kept its own address space for rgrps, but > this > caused a lockdep problem because vfs assumes a 1:1 re

Re: [Cluster-devel] [GFS2 PATCH 09/15] gfs2: fix deadlock in gfs2_ail1_empty withdraw

2021-07-27 Thread Andreas Gruenbacher
Hi Bob, On Tue, Jul 27, 2021 at 7:37 PM Bob Peterson wrote: > Before this patch, function gfs2_ail1_empty could issue a file system > withdraw when IO errors were discovered. However, there are several > callers, including gfs2_flush_revokes() which holds the gfs2_log_lock > before calling gfs2_a

Re: [Cluster-devel] [GFS2 PATCH 00/15] gfs2: misc. patch collection (V2)

2021-07-27 Thread Andreas Gruenbacher
patches from Andreas were added that allow xfstests >generic/079 to run on gfs2. > > Most of these patches are very safe and well-tested. > I left out some of my more experimental patches. > > Andreas Gruenbacher (3): > gfs2: Add wrapper for iomap_file_buffered_write >

Re: [Cluster-devel] gfs2 hang in xfstests generic/361 (v3)

2021-07-27 Thread Andreas Gruenbacher
On Tue, Jul 27, 2021 at 4:05 PM Bob Peterson wrote: > On 7/27/21 2:05 AM, Christoph Hellwig wrote: > > On Mon, Jul 26, 2021 at 01:50:11PM -0500, Bob Peterson wrote: > >> FYI: I just pushed a replacement patch to linux-gfs2/for-next.next4. > >> The patch I mentioned last time had problems, so this

Re: [Cluster-devel] [PATCH v4 1/8] iov_iter: Introduce iov_iter_fault_in_writeable helper

2021-07-27 Thread Andreas Gruenbacher
On Tue, Jul 27, 2021 at 11:30 AM David Laight wrote: > From: Linus Torvalds > > Sent: 24 July 2021 20:53 > > > > On Sat, Jul 24, 2021 at 12:35 PM Andreas Gruenbacher > > wrote: > > > > > > +int iov_iter_fault_in_wri

Re: [Cluster-devel] [PATCH v4 1/8] iov_iter: Introduce iov_iter_fault_in_writeable helper

2021-07-24 Thread Andreas Gruenbacher
On Sat, Jul 24, 2021 at 11:57 PM Al Viro wrote: > On Sat, Jul 24, 2021 at 11:38:20PM +0200, Andreas Gruenbacher wrote: > > > Hmm, how could we have sub-page failure areas when this is about if > > and how pages are mapped? If we return the number of bytes that are > > acc

Re: [Cluster-devel] [PATCH v4 1/8] iov_iter: Introduce iov_iter_fault_in_writeable helper

2021-07-24 Thread Andreas Gruenbacher
On Sat, Jul 24, 2021 at 10:24 PM Al Viro wrote: > On Sat, Jul 24, 2021 at 12:52:34PM -0700, Linus Torvalds wrote: > > ... > > > + if (fault_in_user_pages(start, len, true) != len) > > > + return -EFAULT; > > > > Looking at this once more, I think

[Cluster-devel] [PATCH v4 6/8] iomap: Support restarting direct I/O requests after user copy failures

2021-07-24 Thread Andreas Gruenbacher
-by: Andreas Gruenbacher --- fs/iomap/direct-io.c | 13 + include/linux/iomap.h | 7 +++ 2 files changed, 20 insertions(+) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 51831ce93f6e..1ba825bab08b 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c

[Cluster-devel] [PATCH v4 7/8] iov_iter: Introduce noio flag to disable page faults

2021-07-24 Thread Andreas Gruenbacher
, but it may make sense to check for this flag in other contexts as well. Signed-off-by: Andreas Gruenbacher --- include/linux/uio.h | 1 + lib/iov_iter.c | 20 +++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/linux/uio.h b/include/linux/uio.h index

[Cluster-devel] [PATCH v4 5/8] iomap: Add done_before argument to iomap_dio_rw

2021-07-24 Thread Andreas Gruenbacher
call iomap_dio_rw again for the rest of the request, passing in the number of bytes already tranferred. Signed-off-by: Andreas Gruenbacher --- fs/btrfs/file.c | 5 +++-- fs/ext4/file.c| 5 +++-- fs/gfs2/file.c| 4 ++-- fs/iomap/direct-io.c | 12 fs/xfs/xfs_f

[Cluster-devel] [PATCH v4 0/8] gfs2: Fix mmap + page fault deadlocks

2021-07-24 Thread Andreas Gruenbacher
s won't affect the vfs or iomap patches. Thanks a lot, Andreas Andreas Gruenbacher (8): iov_iter: Introduce iov_iter_fault_in_writeable helper gfs2: Add wrapper for iomap_file_buffered_write gfs2: Fix mmap + page fault deadlocks for buffered I/O iomap: Fix iomap_dio_rw return valu

[Cluster-devel] [PATCH v4 8/8] gfs2: Fix mmap + page fault deadlocks for direct I/O

2021-07-24 Thread Andreas Gruenbacher
physical page faults. Those manual page faults can be disabled with the new iocb->noio flag. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 47 +-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c in

[Cluster-devel] [PATCH v4 3/8] gfs2: Fix mmap + page fault deadlocks for buffered I/O

2021-07-24 Thread Andreas Gruenbacher
s manually, and repeat the operation. This locking problem in gfs2 was originally reported by Jan Kara. Linus came up with the proposal to disable page faults. Many thanks to Al Viro and Matthew Wilcox for their feedback as well. Signed-off-by: Andreas Gruenbacher --- fs/g

[Cluster-devel] [PATCH v4 2/8] gfs2: Add wrapper for iomap_file_buffered_write

2021-07-24 Thread Andreas Gruenbacher
Add a wrapper around iomap_file_buffered_write. We'll add code for when the operation needs to be retried here later. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/f

[Cluster-devel] [PATCH v4 4/8] iomap: Fix iomap_dio_rw return value for user copies

2021-07-24 Thread Andreas Gruenbacher
When a user copy fails in one of the helpers of iomap_dio_rw, fail with -EFAULT instead of returning 0. This matches what iomap_dio_bio_actor already returns when it gets an -EFAULT from bio_iov_iter_get_pages. Signed-off-by: Andreas Gruenbacher --- fs/iomap/direct-io.c | 4 ++-- 1 file

[Cluster-devel] [PATCH v4 1/8] iov_iter: Introduce iov_iter_fault_in_writeable helper

2021-07-24 Thread Andreas Gruenbacher
r isn't in memory. Signed-off-by: Andreas Gruenbacher --- include/linux/mm.h | 3 +++ include/linux/uio.h | 1 + lib/iov_iter.c | 40 +++ mm/gup.c| 57 + 4 files changed, 101 insertions(+) diff --git

[Cluster-devel] [PATCH v3 7/7] gfs2: Fix mmap + page fault deadlocks for direct I/O

2021-07-23 Thread Andreas Gruenbacher
page faults. Those manual page faults can be disabled with the iocb->noio flag. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 34 +- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index f66ac7f56

[Cluster-devel] [PATCH v3 6/7] iov_iter: Introduce noio flag to disable page faults

2021-07-23 Thread Andreas Gruenbacher
, but it may make sense to check for this flag in other contexts as well. Signed-off-by: Andreas Gruenbacher --- include/linux/uio.h | 1 + lib/iov_iter.c | 20 +++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/linux/uio.h b/include/linux/uio.h index

[Cluster-devel] [PATCH v3 5/7] iomap: Support restarting direct I/O requests after user copy failures

2021-07-23 Thread Andreas Gruenbacher
chronously after dealing with the page fault. To make that work, the completion notification would have to include the bytes read or written before the page fault(s) as well, and we'd need an additional iomap_dio_rw argument for that. Signed-off-by: Andreas Gruenbacher --- fs/iomap/

[Cluster-devel] [PATCH v3 4/7] iomap: Fix iomap_dio_rw return value for user copies

2021-07-23 Thread Andreas Gruenbacher
When a user copy fails in one of the helpers of iomap_dio_rw, fail with -EFAULT instead of returning 0. This matches what iomap_dio_bio_actor already returns when it gets an -EFAULT from bio_iov_iter_get_pages. Signed-off-by: Andreas Gruenbacher --- fs/iomap/direct-io.c | 4 ++-- 1 file

[Cluster-devel] [PATCH v3 3/7] gfs2: Fix mmap + page fault deadlocks for buffered I/O

2021-07-23 Thread Andreas Gruenbacher
s manually, and repeat the operation. This locking problem in gfs2 was originally reported by Jan Kara. Linus came up with the proposal to disable page faults. Many thanks to Al Viro and Matthew Wilcox for their feedback as well. Signed-off-by: Andreas Gruenbacher --- fs/g

[Cluster-devel] [PATCH v3 1/7] iov_iter: Introduce fault_in_iov_iter helper

2021-07-23 Thread Andreas Gruenbacher
Signed-off-by: Andreas Gruenbacher --- include/linux/mm.h | 3 ++ include/linux/uio.h | 1 + lib/iov_iter.c | 42 mm/gup.c| 68 + 4 files changed, 114 insertions(+) diff --git a/include/linux/mm.h b/inc

[Cluster-devel] [PATCH v3 2/7] gfs2: Add wrapper for iomap_file_buffered_write

2021-07-23 Thread Andreas Gruenbacher
Add a wrapper around iomap_file_buffered_write. We'll add code for when the operation needs to be retried here later. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/f

[Cluster-devel] [PATCH v3 0/7] gfs2: Fix mmap + page fault deadlocks

2021-07-23 Thread Andreas Gruenbacher
need to be reviewed by Christoph at least: iomap: Fix iomap_dio_rw return value for user copies iomap: Support restarting direct I/O requests after user copy failures Thanks a lot, Andreas Andreas Gruenbacher (7): iov_iter: Introduce fault_in_iov_iter helper gfs2: Add wra

[Cluster-devel] [PATCH v2 5/6] iov_iter: Introduce ITER_FLAG_FAST_ONLY flag

2021-07-18 Thread Andreas Gruenbacher
is enough for iomaop_dio_rw(), but it may make sense to check for this flag in other contexts as well. Signed-off-by: Andreas Gruenbacher --- include/linux/uio.h | 15 --- lib/iov_iter.c | 20 +++- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a

[Cluster-devel] [PATCH v2 2/6] iomap: Fix iomap_dio_rw return value for page faults

2021-07-18 Thread Andreas Gruenbacher
: in that position, we know that we should have been able to read something. Signed-off-by: Andreas Gruenbacher --- fs/iomap/direct-io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 9398b8c31323..a87a43ee8278 100644 --- a/fs/iomap/direct

[Cluster-devel] [PATCH v2 3/6] gfs2: Add wrapper for iomap_file_buffered_write

2021-07-18 Thread Andreas Gruenbacher
Add a wrapper around iomap_file_buffered_write. We'll add code for when the operation needs to be retried here later. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/f

[Cluster-devel] [PATCH v2 0/6] gfs2: Fix mmap + page fault deadlocks

2021-07-18 Thread Andreas Gruenbacher
7;m currently trying to get initial feedback from Al and Christoph on that. Any feedback would be welcome. Thanks a lot, Andreas Andreas Gruenbacher (6): iov_iter: Introduce fault_in_iov_iter helper iomap: Fix iomap_dio_rw return value for page faults gfs2: Add wrapper for iomap_file_buffer

[Cluster-devel] [PATCH v2 6/6] gfs2: Fix mmap + page fault deadlocks for direct I/O

2021-07-18 Thread Andreas Gruenbacher
e new ITER_FLAG_FAST_ONLY flag for telling iomap_dio_rw to stop faulting pages in for us. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 35 ++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 99df793

[Cluster-devel] [PATCH v2 4/6] gfs2: Fix mmap + page fault deadlocks for buffered I/O

2021-07-18 Thread Andreas Gruenbacher
s manually, and repeat the operation. This locking problem in gfs2 was originally reported by Jan Kara. Linus came up with the proposal to disable page faults. Many thanks to Al Viro and Matthew Wilcox for their feedback as well. Signed-off-by: Andreas Gruenbacher --- fs/g

[Cluster-devel] [PATCH v2 1/6] iov_iter: Introduce fault_in_iov_iter helper

2021-07-18 Thread Andreas Gruenbacher
Signed-off-by: Andreas Gruenbacher --- include/linux/mm.h | 3 ++ include/linux/uio.h | 1 + lib/iov_iter.c | 42 mm/gup.c| 68 + 4 files changed, 114 insertions(+) diff --git a/include/linux/mm.h b/inc

Re: [Cluster-devel] [PATCH] gfs2: Fix memory leak of object lsi on error return path

2021-07-12 Thread Andreas Gruenbacher
Hi Colin, On Mon, Jul 12, 2021 at 6:24 PM Colin King wrote: > > From: Colin Ian King > > In the case where IS_ERR(lsi->si_sc_inode) is true the error exit path > to free_local does not kfree the allocated object lsi leading to a memory > leak. Fix this by kfree'ing lst before taking the error ex

Re: [Cluster-devel] [PATCH v3 3/3] iomap: Don't create iomap_page objects in iomap_page_mkwrite_actor

2021-07-09 Thread Andreas Gruenbacher
On Fri, Jul 9, 2021 at 6:29 AM Darrick J. Wong wrote: > On Wed, Jul 07, 2021 at 01:55:24PM +0200, Andreas Gruenbacher wrote: > > Now that we create those objects in iomap_writepage_map when needed, > > there's no need to pre-create them in iomap_page_mkwrite_actor anymore. &

[Cluster-devel] [PATCH v3 1/3] iomap: Permit pages without an iop to enter writeback

2021-07-07 Thread Andreas Gruenbacher
ges in the future (eg page split). Co-developed-by: Matthew Wilcox (Oracle) Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Andreas Gruenbacher Reviewed-by: Christoph Hellwig --- fs/iomap/buffered-io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/iomap/buffered

[Cluster-devel] [PATCH v3 3/3] iomap: Don't create iomap_page objects in iomap_page_mkwrite_actor

2021-07-07 Thread Andreas Gruenbacher
Now that we create those objects in iomap_writepage_map when needed, there's no need to pre-create them in iomap_page_mkwrite_actor anymore. Signed-off-by: Andreas Gruenbacher --- fs/iomap/buffered-io.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/

[Cluster-devel] [PATCH v3 2/3] iomap: Don't create iomap_page objects for inline files

2021-07-07 Thread Andreas Gruenbacher
n't have private data attached in iomap_read_inline_data. Signed-off-by: Andreas Gruenbacher --- fs/iomap/buffered-io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 598fcfabc337..6330dabc451e 100644 --- a/fs/iomap/

[Cluster-devel] [PATCH v3 0/3] iomap: small block problems

2021-07-07 Thread Andreas Gruenbacher
this should now be unnecessary as well, but testing has proven that we're not quite at that point, yet. * Don't create iomap_page objects in iomap_page_mkwrite_actor anymore; this clearly has become obsolete with the first patch. Thanks, Andreas Andreas Gruenbacher (3): ioma

Re: [Cluster-devel] [PATCH v2 1/2] iomap: Don't create iomap_page objects for inline files

2021-07-06 Thread Andreas Gruenbacher
On Tue, Jul 6, 2021 at 7:07 AM Christoph Hellwig wrote: > On Mon, Jul 05, 2021 at 08:18:23PM +0200, Andreas Gruenbacher wrote: > > In iomap_readpage_actor, don't create iop objects for inline inodes. > > Otherwise, iomap_read_inline_data will set PageUptodate without setti

[Cluster-devel] [PATCH v2 2/2] iomap: Permit pages without an iop to enter writeback

2021-07-05 Thread Andreas Gruenbacher
from pages in the future (eg page split). Co-developed-by: Matthew Wilcox (Oracle) Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Andreas Gruenbacher --- fs/iomap/buffered-io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered

[Cluster-devel] [PATCH v2 1/2] iomap: Don't create iomap_page objects for inline files

2021-07-05 Thread Andreas Gruenbacher
n't have private data attached in iomap_read_inline_data. Signed-off-by: Andreas Gruenbacher Reviewed-by: Matthew Wilcox (Oracle) --- fs/iomap/buffered-io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index

[Cluster-devel] [PATCH v2 0/2] iomap: small block problems

2021-07-05 Thread Andreas Gruenbacher
Christoph has pointed out [*], there are several more cases in which we can avoid iop creation. Those improvements are still left to be done. [*] https://lore.kernel.org/linux-fsdevel/ynqy0e4xfwhdh...@infradead.org/ Thanks, Andreas Andreas Gruenbacher (2): iomap: Don't create iomap

Re: [Cluster-devel] [PATCH 0/2] iomap: small block problems

2021-07-05 Thread Andreas Gruenbacher
On Wed, Jun 30, 2021 at 2:29 PM Andreas Gruenbacher wrote: > Darrick, > > will you pick up those two patches and push them to Linus? They both > seem pretty safe. Hello, is there anybody out there? I've put the two patches here with the sign-offs they've received: http

Re: [Cluster-devel] [PATCH] gfs2: Fix mmap + page fault deadlocks

2021-07-01 Thread Andreas Gruenbacher
On Thu, Jul 1, 2021 at 11:41 PM Linus Torvalds wrote: > On Thu, Jul 1, 2021 at 1:43 PM Andreas Gruenbacher > wrote: > > here's another attempt at fixing the mmap + page fault deadlocks we're > > seeing on gfs2. Still not ideal because get_user_pages_

[Cluster-devel] [PATCH] gfs2: Fix mmap + page fault deadlocks

2021-07-01 Thread Andreas Gruenbacher
page faults was suggested by Linus, with help from Al Viro and Matthew Wilcox. Reported-by: Jan Kara Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 81 ++ 1 file changed, 81 insertions(+) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c inde

Re: [Cluster-devel] [PATCH 0/2] iomap: small block problems

2021-06-30 Thread Andreas Gruenbacher
On Wed, Jun 30, 2021 at 4:09 PM Matthew Wilcox wrote: > On Tue, Jun 29, 2021 at 11:12:39AM +0200, Andreas Gruenbacher wrote: > > Below is a version of your patch on top of v5.13 which has passed some > > local testing here. > > > > Thanks, > > Andreas >

Re: [Cluster-devel] [PATCH 0/2] iomap: small block problems

2021-06-30 Thread Andreas Gruenbacher
Darrick, On Tue, Jun 29, 2021 at 7:47 AM Christoph Hellwig wrote: > On Mon, Jun 28, 2021 at 10:59:55PM +0100, Matthew Wilcox wrote: > > > > so permit pages without an iop to enter writeback and create an iop > > > > *then*. Would that solve your problem? > > > > > > It is the right thing to do,

[Cluster-devel] [GIT PULL] Various minor gfs2 cleanups and fixes

2021-06-29 Thread Andreas Gruenbacher
Andreas Gruenbacher (6): gfs2: Fix do_gfs2_set_flags description gfs2: Fix underflow in gfs2_page_mkwrite gfs2: Fix error handling in init_statfs gfs2: Clean up the error handling in gfs2_page_mkwrite gfs2

Re: [Cluster-devel] [PATCH 0/2] iomap: small block problems

2021-06-29 Thread Andreas Gruenbacher
having to worry about how the iop block tracking is implemented. Suggested-by: Matthew Wilcox Signed-off-by: Andreas Gruenbacher --- fs/iomap/buffered-io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 03537ecb2a94

Re: [Cluster-devel] [PATCH 0/2] iomap: small block problems

2021-06-28 Thread Andreas Gruenbacher
On Mon, Jun 28, 2021 at 8:07 PM Christoph Hellwig wrote: > On Mon, Jun 28, 2021 at 06:39:09PM +0100, Matthew Wilcox wrote: > > Not hugely happy with either of these options, tbh. I'd rather we apply > > a patch akin to this one (plucked from the folio tree), so won't apply: > > > so permit pages

Re: [Cluster-devel] [PATCH 0/2] iomap: small block problems

2021-06-28 Thread Andreas Gruenbacher
On Mon, Jun 28, 2021 at 7:40 PM Matthew Wilcox wrote: > On Mon, Jun 28, 2021 at 07:27:25PM +0200, Andreas Gruenbacher wrote: > > (1) In iomap_readpage_actor, an iomap_page is attached to the page even > > for inline inodes. This is unnecessary because inline inodes don't

[Cluster-devel] [PATCH 2/2] iomap: Add helper for un-inlining an inline inode

2021-06-28 Thread Andreas Gruenbacher
From: Bob Peterson Add function iomap_uninline_inode for converting an inline inode into a non-inline inode. This takes care of attaching a new iomap_page object to page->private if the block size is smaller than the page size. Signed-off-by: Andreas Gruenbacher --- fs/iomap/buffered-i

[Cluster-devel] [PATCH 1/2] iomap: Don't create iomap_page objects for inline files

2021-06-28 Thread Andreas Gruenbacher
n't have private data attached in iomap_read_inline_data. Signed-off-by: Andreas Gruenbacher --- fs/iomap/buffered-io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 9023717c5188..03537ecb2a94 100644 --- a/fs/iomap/

[Cluster-devel] [PATCH 0/2] iomap: small block problems

2021-06-28 Thread Andreas Gruenbacher
/git/gfs2/linux-gfs2.git/log/?h=for-next.iomap-page-mkwrite Any thoughts? Thanks, Andreas Andreas Gruenbacher (1): iomap: Don't create iomap_page objects for inline files Bob Peterson (1): iomap: Add helper for un-inlining an inline inode fs/iomap/buffered-io.c | 28 +

Re: [Cluster-devel] [PATCH] gfs2: Fix error handling in init_statfs()

2021-06-28 Thread Andreas Gruenbacher
Hi Jing, On Mon, Jun 28, 2021 at 1:22 PM Jing Xiangfeng wrote: > In an error path of init_statfs(), it calls iput to put pn which has been > put. Jump to correct label to fix it. thanks for your patch. This looks okay, but I'd rather set pn to NULL after the iput instead. Since iput(NULL) is a n

Re: [Cluster-devel] [PATCH -next] gfs2: Use list_move_tail instead of list_del/list_add_tail

2021-06-09 Thread Andreas Gruenbacher
On Tue, Jun 8, 2021 at 5:23 AM Baokun Li wrote: > Using list_move_tail() instead of list_del() + list_add_tail(). Thanks, I'll add that to for-next. Andreas

[Cluster-devel] [GIT PULL] gfs2: Recognize mmap + page fault self-recursion to prevent deadlocks

2021-06-02 Thread Andreas Gruenbacher
06-02 11:44:54 +0200) gfs2: Recognize mmap + page fault self-recursion to prevent deadlocks -------- Andreas Gruenbacher (4): gfs2: Clean up the error handling in gfs2_page_mkwrite g

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

2021-06-02 Thread Andreas Gruenbacher
On Tue, Jun 1, 2021 at 8:00 AM Linus Torvalds wrote: > On Mon, May 31, 2021 at 7:01 AM Andreas Gruenbacher > wrote: > > > > Fix that by recognizing the self-recursion case. > > Hmm. I get the feeling that the self-recursion case should never have > been allowed t

[Cluster-devel] [GIT PULL] Revert "gfs2: Fix mmap locking for write faults"

2021-06-01 Thread Andreas Gruenbacher
fba483f235: Revert "gfs2: Fix mmap locking for write faults" (2021-06-01 23:16:42 +0200) Revert broken commit -------- Andreas Gruenbacher (1): Revert "g

Re: [Cluster-devel] [RFC 0/9] gfs2: handle page faults during read and write

2021-05-31 Thread Andreas Gruenbacher
ecipients. Feel free to quote more just in case > others didn't get my original email through the lists. > > I'll be out most of the day, but I'll try to take a deeper look this evening. > > I'm the meantime, a couple of questions and comments.. > > On Mon, M

Re: [Cluster-devel] [GIT PULL] gfs2 fixes for v5.13-rc5

2021-05-31 Thread Andreas Gruenbacher
On Mon, May 31, 2021 at 6:30 PM Linus Torvalds wrote: > [ Adding fsdevel, because this is not limited to gfs2 ] > > On Mon, May 31, 2021 at 12:56 AM Andreas Gruenbacher > wrote: > > > > Andreas Gruenbacher (2): > > gfs2: Fix mmap locking for write faults >

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

2021-05-31 Thread Andreas Gruenbacher
d fault in the first offending user page. This will re-trigger the "inner" locking attempt but without the "outer" glock being held and without the LM_FLAG_TRY flag. Once that's done, we re-acquire the "outer" glock and retry the original operation. Reported-by: Jan K

[Cluster-devel] [RFC 8/9] gfs2: Add LM_FLAG_OUTER glock holder flag

2021-05-31 Thread Andreas Gruenbacher
When a glock holder has the LM_FLAG_OUTER flag set, we set the current_holds_glock() flag upon taking the lock. With that, we can recognize when trying to take an "inner" glock, and react accordingly. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/glock.c | 12 fs/gf

[Cluster-devel] [RFC 7/9] gfs2: Encode glock holding and retry flags in journal_info

2021-05-31 Thread Andreas Gruenbacher
Use the lowest two bits in current->journal_info to encode when we're holding a glock, and when an operation holding a glock needs to be retried. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/incore.h | 35 +-- 1 file changed, 33 insertions(+), 2 d

[Cluster-devel] [RFC 6/9] gfs2: Add wrappers for accessing journal_info

2021-05-31 Thread Andreas Gruenbacher
No longer access current->journal_info directly. The next patch will change the wrappers to encode additional information in the lower bits of current->journal_info. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/aops.c| 6 +++--- fs/gfs2/bmap.c| 28 ++

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

2021-05-31 Thread Andreas Gruenbacher
Add the equivalent of iov_iter_fault_in_readable(), but for pages that will be written to. While at it, fix an indentation error in iov_iter_fault_in_readable(). Signed-off-by: Andreas Gruenbacher --- include/linux/uio.h | 1 + lib/iov_iter.c | 20 +++- 2 files changed

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

2021-05-31 Thread Andreas Gruenbacher
will handle these case more gracefully by retrying operations instead of failing them, along with addressing more complex deadlock scenarios. Reported-by: Jan Kara Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 40 ++-- 1 file changed, 30 insertions

[Cluster-devel] [RFC 3/9] gfs2: Add gfs2_holder_is_compatible helper

2021-05-31 Thread Andreas Gruenbacher
This function checks if a glock holder's locking state is compatible with another locking state. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/glock.h | 14 ++ 1 file changed, 14 insertions(+) diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h index 31a8f2f649b5..f0ef6fd24ba4 1

[Cluster-devel] [RFC 0/9] gfs2: handle page faults during read and write

2021-05-31 Thread Andreas Gruenbacher
osting of this patch queue: https://listman.redhat.com/archives/cluster-devel/2021-May/msg00073.html New xfstest for mmap + page faults during read / write: https://lore.kernel.org/fstests/20210531152604.240462-1-agrue...@redhat.com/ Andreas Gruenbacher (9): gfs2: Clean up the error handling in gfs2_pa

[Cluster-devel] [RFC 1/9] gfs2: Clean up the error handling in gfs2_page_mkwrite

2021-05-31 Thread Andreas Gruenbacher
We're setting an error number so that block_page_mkwrite_return translates it into the corresponding VM_FAULT_* code in several places, but this is getting confusing, so set the VM_FAULT_* codes directly instead. (No change in functionality.) Signed-off-by: Andreas Gruenbacher --- fs

[Cluster-devel] [RFC 2/9] gfs2: Add wrapper for iomap_file_buffered_write

2021-05-31 Thread Andreas Gruenbacher
Add a wrapper around iomap_file_buffered_write. We'll add code for when the operation needs to be retried here later. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/f

[Cluster-devel] [GIT PULL] gfs2 fixes for v5.13-rc5

2021-05-31 Thread Andreas Gruenbacher
03:28 +0200) Various gfs2 fixes Andreas Gruenbacher (2): gfs2: Prevent direct-I/O write fallback errors from getting lost gfs2: Fix mmap locking for write f

Re: [Cluster-devel] [PATCH 6/6] gfs2: Fix mmap + page fault deadlocks (part 2)

2021-05-21 Thread Andreas Gruenbacher
On Fri, May 21, 2021 at 5:23 PM Jan Kara wrote: > On Thu 20-05-21 16:07:56, Andreas Gruenbacher wrote: > > On Thu, May 20, 2021 at 3:30 PM Jan Kara wrote: > > > On Thu 20-05-21 14:25:36, Andreas Gruenbacher wrote: > > > > Now that we handle self-recursion on the

Re: [Cluster-devel] [PATCH 02/15] fs: gfs2: glock: Fix some deficient kernel-doc headers and demote non-conformant ones

2021-05-20 Thread Andreas Gruenbacher
gfs2/glock.c:1993: warning: Excess function parameter 'wait' description > in 'gfs2_gl_hash_clear' What's that? Those warnings don't exist in mainline, and the two warnings we have in mainline are fixed in for-next: https://git.kernel.org/pub/scm/linux/kernel/gi

Re: [Cluster-devel] [PATCH 6/6] gfs2: Fix mmap + page fault deadlocks (part 2)

2021-05-20 Thread Andreas Gruenbacher
On Thu, May 20, 2021 at 3:30 PM Jan Kara wrote: > On Thu 20-05-21 14:25:36, Andreas Gruenbacher wrote: > > Now that we handle self-recursion on the inode glock in gfs2_fault and > > gfs2_page_mkwrite, we need to take care of more complex deadlock > > scenarios like the foll

[Cluster-devel] [PATCH 2/6] iov_iter: Add iov_iter_fault_in_writeable()

2021-05-20 Thread Andreas Gruenbacher
Add the equivalent of iov_iter_fault_in_readable(), but for pages that will be written to. While at it, fix an indentation error in iov_iter_fault_in_readable(). Signed-off-by: Andreas Gruenbacher --- include/linux/uio.h | 1 + lib/iov_iter.c | 20 +++- 2 files changed

[Cluster-devel] [PATCH 4/6] gfs2: Encode glock holding and retry flags in journal_info

2021-05-20 Thread Andreas Gruenbacher
Use the lowest two bits in current->journal_info to encode when we're holding a glock and when an operation holding a glock needs to be retried. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/incore.h | 35 +-- 1 file changed, 33 insertions(+), 2 d

[Cluster-devel] [PATCH 6/6] gfs2: Fix mmap + page fault deadlocks (part 2)

2021-05-20 Thread Andreas Gruenbacher
d fault in the first offending user page. This will re-trigger the "inner" locking attempt but without the LM_FLAG_TRY flag. Once that has happened, we re-acquire the "outer" glock and retry the original operation. Reported-by: Jan Kara Signed-off

[Cluster-devel] [PATCH 3/6] gfs2: Add wrappers for accessing journal_info

2021-05-20 Thread Andreas Gruenbacher
No longer access current->journal_info directly. We'll use that to encode additional information in current->journal_info later. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/aops.c| 6 +++--- fs/gfs2/bmap.c| 28 ++-- fs/gfs2/incore.h | 10

[Cluster-devel] [PATCH 1/6] gfs2: Fix mmap + page fault deadlocks (part 1)

2021-05-20 Thread Andreas Gruenbacher
handle this case more gracefully, along with addressing more complex deadlock scenarios. Reported-by: Jan Kara Fixes: 20f82c38 ("gfs2: Rework read and page fault locking") Cc: sta...@vger.kernel.org # v5.8+ Signed-off-by: Andreas Gruenbacher --- fs/gfs2/f

[Cluster-devel] [PATCH 5/6] gfs2: Add LM_FLAG_OUTER glock holder flag

2021-05-20 Thread Andreas Gruenbacher
When a glock holder has the LM_FLAG_OUTER flag set, we set the current_holds_glock() flag upon taking the lock. With that flag set, we can then recognize when trying to take an "inner" glock and react accordingly. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/glock.c | 12 ++

[Cluster-devel] [PATCH 0/6] gfs2: Handle page faults during read and write

2021-05-20 Thread Andreas Gruenbacher
operation, https://lore.kernel.org/linux-fsdevel/20210511140113.1225981-1-agrue...@redhat.com/ [2] https://lore.kernel.org/fstests/20210520114218.1595735-1-agrue...@redhat.com/T/#u [3] https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git/log/?h=for-next Andreas Gruenbacher (6)

Re: [Cluster-devel] [PATCH] gfs2: fix uaf in glock shrinker

2021-05-20 Thread Andreas Gruenbacher
On Wed, May 19, 2021 at 8:08 AM Hillf Danton wrote: > The GLF_LRU flag is checked under lru_lock in gfs2_glock_remove_from_lru() to > remove glock from the lru list in __gfs2_glock_put(). > > On the shrink scan path, the same flag is cleared under lru_lock but because > of cond_resched_lock(&lru_l

[Cluster-devel] [PATCH] gfs2: Fix mmap locking for write faults

2021-05-20 Thread Andreas Gruenbacher
When a write fault occurs, we need to take the inode glock of the underlying inode in exclusive mode. Otherwise, there's no guarantee that the dirty page will be written back to disk. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 del

[Cluster-devel] [PATCH] gfs2: Add wrapper for iomap_file_buffered_write

2021-05-20 Thread Andreas Gruenbacher
Add a wrapper around iomap_file_buffered_write. We'll add code for when the operation needs to be retried here later. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/f

[Cluster-devel] [PATCH] gfs2: Add gfs2_holder_is_compatible helper

2021-05-20 Thread Andreas Gruenbacher
This function checks if a glock holder's locking state is compatible with another locking state. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/glock.h | 14 ++ 1 file changed, 14 insertions(+) diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h index 31a8f2f649b5..f0ef6fd24ba4 1

[Cluster-devel] [PATCH] gfs2: Clean up the error handling in gfs2_page_mkwrite

2021-05-20 Thread Andreas Gruenbacher
We're setting an error number so that block_page_mkwrite_return translates it into the corresponding VM_FAULT_* code in several places, but this is getting confusing, so Set the VM_FAULT_* codes directly instead. (No change in functionality.) Signed-off-by: Andreas Gruenbacher --- fs

Re: [Cluster-devel] [syzbot] KASAN: use-after-free Read in gfs2_glock_shrink_scan

2021-05-18 Thread Andreas Gruenbacher
Hi, On Tue, May 18, 2021 at 10:49 AM Hillf Danton wrote: > When put, glock is removed from lru by calling gfs2_glock_remove_from_lru() > in __gfs2_glock_put(), and check GLF_LRU under lru_lock. > > On the shrink scan path, GLF_LRU is cleared under lru_lock but because of > cond_resched_lock(&lru_

Re: [Cluster-devel] [PATCH] [RFC] Trigger retry from fault vm operation

2021-05-11 Thread Andreas Gruenbacher
On Tue, May 11, 2021 at 4:34 PM Matthew Wilcox wrote: > On Tue, May 11, 2021 at 04:01:13PM +0200, Andreas Gruenbacher wrote: > > we have a locking problem in gfs2 that I don't have a proper solution for, > > so > > I'm looking for suggestions. > > >

[Cluster-devel] [PATCH] [RFC] Trigger retry from fault vm operation

2021-05-11 Thread Andreas Gruenbacher
Hello, we have a locking problem in gfs2 that I don't have a proper solution for, so I'm looking for suggestions. What's happening is that a page fault triggers during a read or write operation, while we're holding a glock (the cluster-wide gfs2 inode lock), and the page fault requires another gl

[Cluster-devel] [PATCH] gfs2: Fix mmap + page fault deadlock

2021-05-11 Thread Andreas Gruenbacher
.org # v5.8+ Signed-off-by: Andreas Gruenbacher --- fs/gfs2/file.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 3ebc9af39a04..658fed79d65a 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -538,18 +538,22 @@ static vm_fa

<    1   2   3   4   5   6   7   8   9   10   >