Re: [Cluster-devel] [RFC][arm64] possible infinite loop in btrfs search_ioctl()

2021-10-11 Thread Linus Torvalds
On Mon, Oct 11, 2021 at 2:08 PM Catalin Marinas wrote: > > +#ifdef CONFIG_ARM64_MTE > +#define FAULT_GRANULE_SIZE (16) > +#define FAULT_GRANULE_MASK (~(FAULT_GRANULE_SIZE-1)) [...] > If this looks in the right direction, I'll do some proper patches > tomorrow. Looks fine to me. It's goi

Re: [Cluster-devel] [RFC][arm64] possible infinite loop in btrfs search_ioctl()

2021-10-11 Thread Catalin Marinas
On Mon, Oct 11, 2021 at 12:15:43PM -0700, Linus Torvalds wrote: > On Mon, Oct 11, 2021 at 10:38 AM Catalin Marinas > wrote: > > I cleaned up this patch [1] but I realised it still doesn't solve it. > > The arm64 __copy_to_user_inatomic(), while ensuring progress if called > > in a loop, it does no

[Cluster-devel] [GFS2 v3 PATCH 13/13] gfs2: set glock object after nq

2021-10-11 Thread Bob Peterson
Before this patch, function gfs2_create_inode called glock_set_object to set the gl_object for inode and iopen glocks before the glock was locked. That's wrong because other competing processes like evict may be blocked waiting for the glock and still have gl_object set before the actual eviction c

[Cluster-devel] [GFS2 v3 PATCH 10/13] gfs2: fix GL_SKIP node_scope problems

2021-10-11 Thread Bob Peterson
Before this patch, when a glock was locked, the very first holder on the queue would unlock the lockref and call the go_instantiate glops function (if one existed), unless GL_SKIP was specified. When we introduced the new node-scope concept, we allowed multiple holders to lock glocks in EX mode and

[Cluster-devel] [GFS2 v3 PATCH 05/13] gfs2: change go_lock to go_instantiate

2021-10-11 Thread Bob Peterson
Before this patch, the go_lock glock operations (glops) did not do any actual locking. They were used to instantiate objects, like reading in dinodes and rgrps from the media. This patch renames the functions to go_instantiate for clarity. Signed-off-by: Bob Peterson Signed-off-by: Andreas Gruen

[Cluster-devel] [GFS2 v3 PATCH 12/13] gfs2: remove RDF_UPTODATE flag

2021-10-11 Thread Bob Peterson
The new GLF_INSTANTIATE_NEEDED flag obsoletes the old rgrp flag GFS2_RDF_UPTODATE, so this patch replaces it like we did with inodes. Signed-off-by: Bob Peterson Signed-off-by: Andreas Gruenbacher --- fs/gfs2/glops.c | 2 +- fs/gfs2/incore.h | 1 - fs/gfs2/rgrp.c | 36 ++---

[Cluster-devel] [GFS2 v3 PATCH 11/13] gfs2: Eliminate GIF_INVALID flag

2021-10-11 Thread Bob Peterson
With the addition of the new GLF_INSTANTIATE_NEEDED flag, the GIF_INVALID flag is now redundant. This patch removes it. Since inode_instantiate is only called when instantiation is needed, the check in inode_instantiate is removed too. Signed-off-by: Bob Peterson Signed-off-by: Andreas Gruenbache

[Cluster-devel] [GFS2 v3 PATCH 09/13] gfs2: split glock instantiation off from do_promote

2021-10-11 Thread Bob Peterson
Before this patch, function do_promote had a section of code that did the actual instantiation. This patch splits that off into its own function, gfs2_instantiate, which prepares us for the next patch that will use that function. Signed-off-by: Bob Peterson Signed-off-by: Andreas Gruenbacher --

[Cluster-devel] [GFS2 v3 PATCH 07/13] gfs2: re-factor function do_promote

2021-10-11 Thread Bob Peterson
This patch simply re-factors function do_promote to reduce the indents. The logic should be unchanged. This makes future patches more readable. Signed-off-by: Bob Peterson Signed-off-by: Andreas Gruenbacher --- fs/gfs2/glock.c | 51 - 1 file chang

[Cluster-devel] [GFS2 v3 PATCH 08/13] gfs2: further simplify do_promote

2021-10-11 Thread Bob Peterson
This patch further simplifies function do_promote by eliminating some redundant code in favor of using a lock_released flag. This is just prep work for a future patch. Signed-off-by: Bob Peterson Signed-off-by: Andreas Gruenbacher --- fs/gfs2/glock.c | 41 ++-

[Cluster-devel] [GFS2 v3 PATCH 01/13] gfs2: Allow append and immutable bits to coexist

2021-10-11 Thread Bob Peterson
Before this patch, function do_gfs2_set_flags checked if the append and immutable flags were being set while already set. If so, error -EPERM was given. There's no reason why these two flags should be mutually exclusive, and if you set them separately, you will, in essence, set one while it is alre

[Cluster-devel] [GFS2 v3 PATCH 03/13] gfs2: dequeue iopen holder in gfs2_inode_lookup error

2021-10-11 Thread Bob Peterson
Before this patch, if function gfs2_inode_lookup encountered an error after it had locked the iopen glock, it never unlocked it, relying on the evict code to do the cleanup. The evict code then took the inode glock while holding the iopen glock, which violates the locking order. For example, (1

[Cluster-devel] [GFS2 v3 PATCH 04/13] gfs2: dump glocks from gfs2_consist_OBJ_i

2021-10-11 Thread Bob Peterson
Before this patch, failed consistency checks printed out the object that failed, but not the object's glock. This patch makes it also print out the object glock so we can see the glock's holders and flags to aid with debugging. Signed-off-by: Bob Peterson Signed-off-by: Andreas Gruenbacher ---

[Cluster-devel] [GFS2 v3 PATCH 02/13] gfs2: Save ip from gfs2_glock_nq_init

2021-10-11 Thread Bob Peterson
From: Andreas Gruenbacher Before this patch, when a glock was locked by function gfs2_glock_nq_init, it initialized the holder gh_ip (return address) as gfs2_glock_nq_init. That made it extremely difficult to track down problems because many functions call gfs2_glock_nq_init. This patch changes t

[Cluster-devel] [GFS2 v3 PATCH 06/13] gfs2: Remove 'first' trace_gfs2_promote argument

2021-10-11 Thread Bob Peterson
From: Andreas Gruenbacher Remove the 'first' argument of trace_gfs2_promote: with GL_SKIP, the 'first' holder isn't the one that instantiates the glock (gl_instantiate), which is what the 'first' flag was apparently supposed to indicate. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/glock.c

[Cluster-devel] [GFS2 v3 PATCH 00/13] gfs2: fix bugs related to node_scope and go_lock

2021-10-11 Thread Bob Peterson
Hi, This is version 3 of my patch collection: these are bugs and/or improvements I made as a result of the recent "node scope" bugs and problems encountered during the testing of them. In other words, some of the patches are not directly related to the "node scope" bug directly, but they were foun

Re: [Cluster-devel] [RFC][arm64] possible infinite loop in btrfs search_ioctl()

2021-10-11 Thread Linus Torvalds
On Mon, Oct 11, 2021 at 10:38 AM Catalin Marinas wrote: > > I cleaned up this patch [1] but I realised it still doesn't solve it. > The arm64 __copy_to_user_inatomic(), while ensuring progress if called > in a loop, it does not guarantee precise copy to the fault position. That should be ok., We'

[Cluster-devel] [PATCH] gfs2: Cancel remote delete work asynchronously

2021-10-11 Thread Andreas Gruenbacher
In gfs2_inode_lookup and gfs2_create_inode, we're calling gfs2_cancel_delete_work which currently cancels any remote delete work (delete_work_func) synchronously. This means that if the work is currently running, it will wait for it to finish. We're doing this to pevent a previous instance of an

Re: [Cluster-devel] [RFC][arm64] possible infinite loop in btrfs search_ioctl()

2021-10-11 Thread Catalin Marinas
On Tue, Aug 31, 2021 at 03:28:57PM +, Al Viro wrote: > On Tue, Aug 31, 2021 at 02:54:50PM +0100, Catalin Marinas wrote: > > An arm64-specific workaround would be for pagefault_disable() to disable > > tag checking. It's a pretty big hammer, weakening the out of bounds > > access detection of MT