Re: [PATCH 0/3] Fix some seq_file users that were recently broken

2021-02-07 Thread NeilBrown
On Fri, Feb 05 2021, Andrew Morton wrote: > On Fri, 05 Feb 2021 11:36:30 +1100 NeilBrown wrote: > >> A recent change to seq_file broke some users which were using seq_file >> in a non-"standard" way ... though the "standard" isn't documented, so >&g

[PATCH 3/3] net: fix iteration for sctp transport seq_files

2021-02-04 Thread NeilBrown
fs/seq_file.c: simplify seq_file iteration code and interface") Reported-by: Xin Long Signed-off-by: NeilBrown --- net/sctp/proc.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/net/sctp/proc.c b/net/sctp/proc.c index f7da88ae20a5..982a87b3e11f 100

[PATCH 0/3] Fix some seq_file users that were recently broken

2021-02-04 Thread NeilBrown
the other. These three patches: 1/ document and explain the problem 2/ fix the problem user in x86 3/ fix the problem user in net/sctp I suspect the patches should each go through the relevant subsystems, but I'm including akpm as the original went through him. Thanks, NeilBrown --- NeilBro

Re: [PATCH AUTOSEL 5.4 26/35] SUNRPC: defer slow parts of rpc_free_client() to a workqueue.

2020-05-07 Thread NeilBrown
On Thu, May 07 2020, Sasha Levin wrote: > From: NeilBrown > > [ Upstream commit 7c4310ff56422ea43418305d22bbc5fe19150ec4 ] This one is buggy - it introduces a use-after-free. Best delay it for now. NeilBrown > > The rpciod workqueue is on the write-out path for freeing dirty

Re: [PATCH net] rhashtable: fix sparse RCU warnings on bit lock in bucket pointer

2019-05-15 Thread NeilBrown
have a proper look next week, if only to find out how I didn't get the warnings, as I was testing with sparse. Thanks, NeilBrown > --- > include/linux/rhashtable.h | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/include/linux/rhashtable.h b/

RE: [PATCH 3/4] rhashtable: use bit_spin_locks to protect hash bucket.

2019-04-03 Thread NeilBrown
On Wed, Apr 03 2019, David Laight wrote: > From: NeilBrown >> Sent: 02 April 2019 22:11 >> >> On Tue, Apr 02 2019, David Laight wrote: >> >> > From: NeilBrown >> >> Sent: 02 April 2019 00:08 >> >> >> >> This patch changes

Re: [PATCH 0/3]: net: dsa: mt7530: support MT7530 in the MT7621 SoC

2018-12-16 Thread NeilBrown
On Sun, Dec 16 2018, Florian Fainelli wrote: > On December 16, 2018 3:19:22 PM PST, NeilBrown wrote: >>On Sun, Dec 16 2018, David Miller wrote: >> >>> From: NeilBrown >>> Date: Mon, 17 Dec 2018 09:08:54 +1100 >>> >>>> In my

Re: [PATCH 0/3]: net: dsa: mt7530: support MT7530 in the MT7621 SoC

2018-12-16 Thread NeilBrown
On Sun, Dec 16 2018, David Miller wrote: > From: NeilBrown > Date: Mon, 17 Dec 2018 09:08:54 +1100 > >> In my 4.4 kernel, the build_skb() call in (the equivalent of) >> mtk_poll_rx() takes about 1.2usec and the call to napi_gro_receive() >> takes about 3usec. >

Re: [PATCH 0/3]: net: dsa: mt7530: support MT7530 in the MT7621 SoC

2018-12-16 Thread NeilBrown
On Tue, Dec 11 2018, NeilBrown wrote: > > I got your patch working on 4.20-rc5 and did a performance comparison. > With the staging driver (using iperf3) I get > 220 MBit/sec in > 680 MBit/sec out > > with the patched mainline driver I get > 190 MBit/sec in >9

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-12 Thread NeilBrown
On Thu, Dec 13 2018, Herbert Xu wrote: > On Wed, Dec 12, 2018 at 07:49:08PM +1100, NeilBrown wrote: >> On Wed, Dec 12 2018, Herbert Xu wrote: >> >> > On Wed, Dec 12, 2018 at 05:41:29PM +1100, NeilBrown wrote: >> >> >> >> So you would substant

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-12 Thread NeilBrown
On Wed, Dec 12 2018, Herbert Xu wrote: > On Wed, Dec 12, 2018 at 05:41:29PM +1100, NeilBrown wrote: >> >> So you would substantially slow down the rhashtable_walk_start() step. > > This whole thing is meant for uses such as /proc and netlink > enumeration. Speed is defi

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-11 Thread NeilBrown
On Wed, Dec 12 2018, Herbert Xu wrote: > On Wed, Dec 12, 2018 at 11:02:35AM +1100, NeilBrown wrote: >> >> So I think this is a real bug - it is quite unlikely to hit, but >> possibly. >> You need a chain with at least 2 objects, you need >> rhashtable_walk_stop

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-11 Thread NeilBrown
On Tue, Dec 11 2018, Herbert Xu wrote: > Hi Neil: > > On Mon, Dec 10, 2018 at 09:50:43AM +1100, NeilBrown wrote: >> I think it was agreed that I would not pursue features that were only >> of use to out-of-tree code, but I don't think that applies here. This >&

Re: [PATCH 0/3]: net: dsa: mt7530: support MT7530 in the MT7621 SoC

2018-12-10 Thread NeilBrown
, but thought I would mention it. Strangely when I test with scp, I get about 10MB/sec in both directions with both drivers. Maybe the CPU limits encryption speed. I have a 4.4-based kernel where I get 940MBit/sec both ways - using a precursor of the current staging driver. Thanks, NeilBrown

Re: [PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-09 Thread NeilBrown
On Fri, Dec 07 2018, Herbert Xu wrote: > On Wed, Dec 05, 2018 at 02:51:02PM +1100, NeilBrown wrote: >> >> If the sequence: >>obj = rhashtable_walk_next(iter); >>rhashtable_walk_stop(iter); >>rhashtable_remove_fast(ht, &obj->head, p

[PATCH net-next] rhashtable: further improve stability of rhashtable_walk

2018-12-04 Thread NeilBrown
t() - when rhashtable_walk_next() is called while p is not NULL and not safe, it walks the chain looking for the first object with an address greater than p and returns that. If there is none, it moves to the next hash chain. Signed-off-by: NeilBrown --- This is a resend of a patc

[PATCH] rhashtable: detect when object movement between tables might have invalidated a lookup

2018-12-03 Thread NeilBrown
SLAB_TYPESAFE_BY_RCU or changing the key of an object and re-inserting it in the same table. These could only be done safely if new objects were inserted at the *start* of a hash chain, and that is not currently the case. Acked-by: Herbert Xu Signed-off-by: NeilBrown --- Thanks Herbert, here is the patch

Re: [PATCH v3] rhashtable: detect when object movement between tables might have invalidated a lookup

2018-12-02 Thread NeilBrown
On Sat, Dec 01 2018, Herbert Xu wrote: > On Fri, Nov 30, 2018 at 10:26:50AM +1100, NeilBrown wrote: >> >> diff --git a/lib/rhashtable.c b/lib/rhashtable.c >> index 30526afa8343..852ffa5160f1 100644 >> --- a/lib/rhashtable.c >> +++ b/lib/rhashtable.c >>

[PATCH v3] rhashtable: detect when object movement between tables might have invalidated a lookup

2018-11-29 Thread NeilBrown
SLAB_TYPESAFE_BY_RCU or changing the key of an object and re-inserting it in the same table. These could only be done safely if new objects were inserted at the *start* of a hash chain, and that is not currently the case. Signed-off-by: NeilBrown --- This version has an added comment to explain the &quo

Re: [PATCH 2/5] rhashtable: don't hold lock on first table throughout insertion.

2018-07-24 Thread NeilBrown
On Tue, Jul 24 2018, Paul E. McKenney wrote: > On Tue, Jul 24, 2018 at 07:52:03AM +1000, NeilBrown wrote: >> On Mon, Jul 23 2018, Paul E. McKenney wrote: >> >> > On Mon, Jul 23, 2018 at 09:13:43AM +1000, NeilBrown wrote: >> >> On Sun, Jul 22 2018, Paul E.

Re: [PATCH - revised] rhashtable: detect when object movement might have invalidated a lookup

2018-07-15 Thread NeilBrown
On Mon, Jul 16 2018, Herbert Xu wrote: > On Mon, Jul 16, 2018 at 09:57:11AM +1000, NeilBrown wrote: >> >> Some users of rhashtable might need to change the key >> of an object and move it to a different location in the table. >> Other users might wan

Re: [PATCH 2/8] rhashtable: remove nulls_base and related code.

2018-05-07 Thread NeilBrown
On Mon, May 07 2018, Herbert Xu wrote: > On Sun, May 06, 2018 at 07:37:49AM +1000, NeilBrown wrote: >> >> I can see no evidence that this is required for anything, as it isn't >> use and I'm fairly sure that in it's current form - it cannot be used. > &

Re: [PATCH 6/8] rhashtable: further improve stability of rhashtable_walk

2018-05-07 Thread NeilBrown
On Mon, May 07 2018, Herbert Xu wrote: > On Sun, May 06, 2018 at 07:50:54AM +1000, NeilBrown wrote: >> >> Do we? How could we fix it for both rhashtable and rhltable? > > Well I suggested earlier to insert the walker object into the > hash table, which would be applicab

Re: [PATCH 8/8] rhashtable: don't hold lock on first table throughout insertion.

2018-05-07 Thread NeilBrown
On Mon, May 07 2018, Herbert Xu wrote: > On Mon, May 07, 2018 at 08:24:41AM +1000, NeilBrown wrote: >> >> This is true, but I don't see how it is relevant. >> At some point, each thread will find that the table they have just >> locked for their search key, has a

Re: [PATCH 8/8] rhashtable: don't hold lock on first table throughout insertion.

2018-05-06 Thread NeilBrown
On Sun, May 06 2018, Herbert Xu wrote: > On Sun, May 06, 2018 at 08:00:49AM +1000, NeilBrown wrote: >> >> The insert function must (and does) take the lock on the bucket before >> testing if there is a "next" table. >> If one inserter finds that it has locked

Re: [PATCH 7/8] rhashtable: add rhashtable_walk_prev()

2018-05-06 Thread NeilBrown
On Sat, May 05 2018, Tom Herbert wrote: > On Sat, May 5, 2018 at 2:43 AM, Herbert Xu > wrote: >> On Fri, May 04, 2018 at 01:54:14PM +1000, NeilBrown wrote: >>> rhashtable_walk_prev() returns the object returned by >>> the previous rhashtable_walk_next(), providin

Re: [PATCH 4/8] rhashtable: fix race in nested_table_alloc()

2018-05-06 Thread NeilBrown
On Sun, May 06 2018, Herbert Xu wrote: > On Sun, May 06, 2018 at 07:48:20AM +1000, NeilBrown wrote: >> >> The spinlock protects 2 or more buckets. The nested table contains at >> least 512 buckets, maybe more. >> It is quite possible for two insertions into 2 diffe

Re: [PATCH 8/8] rhashtable: don't hold lock on first table throughout insertion.

2018-05-05 Thread NeilBrown
On Sat, May 05 2018, Herbert Xu wrote: > On Fri, May 04, 2018 at 01:54:14PM +1000, NeilBrown wrote: >> rhashtable_try_insert() currently hold a lock on the bucket in >> the first table, while also locking buckets in subsequent tables. >> This is unnecessary and looks like

Re: [PATCH 6/8] rhashtable: further improve stability of rhashtable_walk

2018-05-05 Thread NeilBrown
On Sat, May 05 2018, Herbert Xu wrote: > On Fri, May 04, 2018 at 01:54:14PM +1000, NeilBrown wrote: >> If the sequence: >>obj = rhashtable_walk_next(iter); >>rhashtable_walk_stop(iter); >>rhashtable_remove_fast(ht, &obj->head, params); >>rh

Re: [PATCH 1/8] rhashtable: silence RCU warning in rhashtable_test.

2018-05-05 Thread NeilBrown
On Sat, May 05 2018, Herbert Xu wrote: > On Fri, May 04, 2018 at 01:54:14PM +1000, NeilBrown wrote: >> print_ht in rhashtable_test calls rht_dereference() with neither >> RCU protection or the mutex. This triggers an RCU warning. >> So take the mutex to silence the warning.

Re: [PATCH 4/8] rhashtable: fix race in nested_table_alloc()

2018-05-05 Thread NeilBrown
On Sat, May 05 2018, Herbert Xu wrote: > On Fri, May 04, 2018 at 01:54:14PM +1000, NeilBrown wrote: >> If two threads run nested_table_alloc() at the same time >> they could both allocate a new table. >> Best case is that one of them will never be freed, leaking memory. >&

Re: [PATCH 3/8] rhashtable: use cmpxchg() to protect ->future_tbl.

2018-05-05 Thread NeilBrown
On Sat, May 05 2018, Herbert Xu wrote: > On Fri, May 04, 2018 at 01:54:14PM +1000, NeilBrown wrote: >> Rather than borrowing one of the bucket locks to >> protect ->future_tbl updates, use cmpxchg(). >> This gives more freedom to change how bucket locking >> is imp

Re: [PATCH 2/8] rhashtable: remove nulls_base and related code.

2018-05-05 Thread NeilBrown
On Sat, May 05 2018, Herbert Xu wrote: > On Fri, May 04, 2018 at 01:54:14PM +1000, NeilBrown wrote: >> This "feature" is unused, undocumented, and untested and so >> doesn't really belong. If a use for the nulls marker >> is found, all this code would need to

[PATCH 0/8] Assorted rhashtable fixes and cleanups

2018-05-03 Thread NeilBrown
, NeilBrown --- NeilBrown (8): rhashtable: silence RCU warning in rhashtable_test. rhashtable: remove nulls_base and related code. rhashtable: use cmpxchg() to protect ->future_tbl. rhashtable: fix race in nested_table_alloc() rhashtable: remove rhashtable_walk_p

[PATCH 1/8] rhashtable: silence RCU warning in rhashtable_test.

2018-05-03 Thread NeilBrown
print_ht in rhashtable_test calls rht_dereference() with neither RCU protection or the mutex. This triggers an RCU warning. So take the mutex to silence the warning. Signed-off-by: NeilBrown --- lib/test_rhashtable.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/lib

[PATCH 2/8] rhashtable: remove nulls_base and related code.

2018-05-03 Thread NeilBrown
Signed-off-by: NeilBrown --- include/linux/rhashtable.h | 35 +++ lib/rhashtable.c |8 lib/test_rhashtable.c |5 + 3 files changed, 4 insertions(+), 44 deletions(-) diff --git a/include/linux/rhashtable.h b/include/linux/rha

[PATCH 3/8] rhashtable: use cmpxchg() to protect ->future_tbl.

2018-05-03 Thread NeilBrown
Rather than borrowing one of the bucket locks to protect ->future_tbl updates, use cmpxchg(). This gives more freedom to change how bucket locking is implemented. Signed-off-by: NeilBrown --- lib/rhashtable.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --

[PATCH 6/8] rhashtable: further improve stability of rhashtable_walk

2018-05-03 Thread NeilBrown
htable_walk_next() - when rhashtable_walk_next() is called while p is not NULL and not safe, it walks the chain looking for the first object with an address greater than p and returns that. If there is none, it moves to the next hash chain. Signed-off-by: NeilBrown --- include/lin

[PATCH 4/8] rhashtable: fix race in nested_table_alloc()

2018-05-03 Thread NeilBrown
the unused table. Fixes: da20420f83ea ("rhashtable: Add nested tables") Cc: sta...@vger.kernel.org # 4.11+ Signed-off-by: NeilBrown --- lib/rhashtable.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/rhashtable.c b/lib/rhashtable.c index b7

[PATCH 7/8] rhashtable: add rhashtable_walk_prev()

2018-05-03 Thread NeilBrown
sh the current location in the table. If it returns NULL, then rhashtable_walk_next() should be used. Signed-off-by: NeilBrown --- include/linux/rhashtable.h |1 + lib/rhashtable.c | 31 +++ 2 files changed, 32 insertions(+) diff --git a/include

[PATCH 8/8] rhashtable: don't hold lock on first table throughout insertion.

2018-05-03 Thread NeilBrown
et table (as the minimum size is 4). Signed-off-by: NeilBrown --- include/linux/rhashtable.h | 13 - lib/rhashtable.c | 42 ++ 2 files changed, 10 insertions(+), 45 deletions(-) diff --git a/include/linux/rhashtable.h b/include/li

[PATCH 5/8] rhashtable: remove rhashtable_walk_peek()

2018-05-03 Thread NeilBrown
eping, so remove it. Signed-off-by: NeilBrown --- include/linux/rhashtable.h |1 - lib/rhashtable.c | 34 -- 2 files changed, 35 deletions(-) diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h index 8822924dd05a..5091abf975a1 100644

[PATCH 1/4] rhashtable: remove outdated comments about grow_decision etc

2018-04-23 Thread NeilBrown
grow_decision and shink_decision no longer exist, so remove the remaining references to them. Acked-by: Herbert Xu Signed-off-by: NeilBrown --- include/linux/rhashtable.h | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/include/linux

[PATCH 0/4] A few rhashtables cleanups

2018-04-23 Thread NeilBrown
2 patches fixes documentation 1 fixes a bit in rhashtable_walk_start() 1 improves rhashtable_walk stability. All reviewed and Acked. Thanks, NeilBrown --- NeilBrown (4): rhashtable: remove outdated comments about grow_decision etc rhashtable: Revise incorrect comment on r{hl,hash

[PATCH 4/4] rhashtable: improve rhashtable_walk stability when stop/start used.

2018-04-23 Thread NeilBrown
nd the object even though it is still in the hashtable if a rehash has moved it to a new table. In this case it will (eventually) get -EAGAIN and will need to proceed through the whole table again to be sure to see everything at least once. Acked-by: Herbert Xu Signed-off-by: NeilBrown

[PATCH 3/4] rhashtable: reset iter when rhashtable_walk_start sees new table

2018-04-23 Thread NeilBrown
The documentation claims that when rhashtable_walk_start_check() detects a resize event, it will rewind back to the beginning of the table. This is not true. We need to set ->slot and ->skip to be zero for it to be true. Acked-by: Herbert Xu Signed-off-by: NeilBrown --- lib/rhasht

[PATCH 2/4] rhashtable: Revise incorrect comment on r{hl, hash}table_walk_enter()

2018-04-23 Thread NeilBrown
Neither rhashtable_walk_enter() or rhltable_walk_enter() sleep, though they do take a spinlock without irq protection. So revise the comments to accurately state the contexts in which these functions can be called. Acked-by: Herbert Xu Signed-off-by: NeilBrown --- include/linux/rhashtable.h

Re: [PATCH 1/6] rhashtable: remove outdated comments about grow_decision etc

2018-04-22 Thread NeilBrown
On Wed, Apr 18 2018, David Miller wrote: > From: NeilBrown > Date: Thu, 19 Apr 2018 09:09:05 +1000 > >> On Wed, Apr 18 2018, Herbert Xu wrote: >> >>> On Wed, Apr 18, 2018 at 04:47:01PM +1000, NeilBrown wrote: >>>> grow_decision and shink_decision no

Re: [PATCH 2/6] rhashtable: remove incorrect comment on r{hl, hash}table_walk_enter()

2018-04-22 Thread NeilBrown
On Thu, Apr 19 2018, Herbert Xu wrote: > On Thu, Apr 19, 2018 at 08:56:28AM +1000, NeilBrown wrote: >> >> I don't want to do that - I just want the documentation to be correct >> (or at least, not be blatantly incorrect). The function does not sleep, >> and is s

Re: [PATCH 1/6] rhashtable: remove outdated comments about grow_decision etc

2018-04-18 Thread NeilBrown
On Wed, Apr 18 2018, Herbert Xu wrote: > On Wed, Apr 18, 2018 at 04:47:01PM +1000, NeilBrown wrote: >> grow_decision and shink_decision no longer exist, so remove >> the remaining references to them. >> >> Signed-off-by: NeilBrown > > Acked-by: Herbert Xu Th

Re: [PATCH 6/6] rhashtable: add rhashtable_walk_prev()

2018-04-18 Thread NeilBrown
On Wed, Apr 18 2018, Herbert Xu wrote: > On Wed, Apr 18, 2018 at 04:47:02PM +1000, NeilBrown wrote: >> rhashtable_walk_prev() returns the object returned by >> the previous rhashtable_walk_next(), providing it is still in the >> table (or was during this grace period).

Re: [PATCH 2/6] rhashtable: remove incorrect comment on r{hl, hash}table_walk_enter()

2018-04-18 Thread NeilBrown
On Wed, Apr 18 2018, Herbert Xu wrote: > On Wed, Apr 18, 2018 at 04:47:01PM +1000, NeilBrown wrote: >> Neither rhashtable_walk_enter() or rhltable_walk_enter() sleep, so >> remove the comments which suggest that they do. >> >> Signed-off-by: NeilBrown >> -

[PATCH 0/6] Assorted rhashtable improvements. RESEND

2018-04-18 Thread NeilBrown
y suggested it might be good for some of these patches to go upstream through 'staging' with the lustre patches. I no longer think that is necessary. It is probably best for them to go upstream through net or net-next. Thanks, NeilBrown --- NeilBrown (6): rhashtable:

[PATCH 1/6] rhashtable: remove outdated comments about grow_decision etc

2018-04-18 Thread NeilBrown
grow_decision and shink_decision no longer exist, so remove the remaining references to them. Signed-off-by: NeilBrown --- include/linux/rhashtable.h | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/include/linux/rhashtable.h b/include

[PATCH 2/6] rhashtable: remove incorrect comment on r{hl, hash}table_walk_enter()

2018-04-18 Thread NeilBrown
Neither rhashtable_walk_enter() or rhltable_walk_enter() sleep, so remove the comments which suggest that they do. Signed-off-by: NeilBrown --- include/linux/rhashtable.h |3 --- lib/rhashtable.c |3 --- 2 files changed, 6 deletions(-) diff --git a/include/linux/rhashtable.h

[PATCH 4/6] rhashtable: improve rhashtable_walk stability when stop/start used.

2018-04-18 Thread NeilBrown
nd the object even though it is still in the hashtable if a rehash has moved it to a new table. In this case it will (eventually) get -EAGAIN and will need to proceed through the whole table again to be sure to see everything at least once. Acked-by: Herbert Xu Signed-off-by: NeilBrown

[PATCH 3/6] rhashtable: reset iter when rhashtable_walk_start sees new table

2018-04-18 Thread NeilBrown
The documentation claims that when rhashtable_walk_start_check() detects a resize event, it will rewind back to the beginning of the table. This is not true. We need to set ->slot and ->skip to be zero for it to be true. Acked-by: Herbert Xu Signed-off-by: NeilBrown --- lib/rhasht

[PATCH 5/6] rhashtable: further improve stability of rhashtable_walk

2018-04-18 Thread NeilBrown
htable_walk_next() - when rhashtable_walk_next() is called while p is not NULL and not safe, it walks the chain looking for the first object with an address greater than p and returns that. If there is none, it moves to the next hash chain. Signed-off-by: NeilBrown --- include/linux

[PATCH 6/6] rhashtable: add rhashtable_walk_prev()

2018-04-18 Thread NeilBrown
sh the current location in the table. If it returns NULL, then rhashtable_walk_next() should be used. Signed-off-by: NeilBrown --- include/linux/rhashtable.h |1 + lib/rhashtable.c | 30 ++ 2 files changed, 31 insertions(+) diff --git a/include

[PATCH 6/6] rhashtable: add rhashtable_walk_prev()

2018-04-17 Thread NeilBrown
sh the current location in the table. If it returns NULL, then rhashtable_walk_next() should be used. Signed-off-by: NeilBrown --- include/linux/rhashtable.h |1 + lib/rhashtable.c | 30 ++ 2 files changed, 31 insertions(+) diff --git a/include

[PATCH 5/6] rhashtable: further improve stability of rhashtable_walk

2018-04-17 Thread NeilBrown
htable_walk_next() - when rhashtable_walk_next() is called while p is not NULL and not safe, it walks the chain looking for the first object with an address greater than p and returns that. If there is none, it moves to the next hash chain. Signed-off-by: NeilBrown --- include/linux

[PATCH 0/6] Assorted rhashtable improvements.

2018-04-17 Thread NeilBrown
es. I no longer think that is necessary. It is probably best for them to go upstream through net or net-next. Thanks, NeilBrown --- NeilBrown (6): rhashtable: remove outdated comments about grow_decision etc rhashtable: remove incorrect comment on r{hl,hash}table_walk_enter()

[PATCH 3/6] rhashtable: reset iter when rhashtable_walk_start sees new table

2018-04-17 Thread NeilBrown
The documentation claims that when rhashtable_walk_start_check() detects a resize event, it will rewind back to the beginning of the table. This is not true. We need to set ->slot and ->skip to be zero for it to be true. Acked-by: Herbert Xu Signed-off-by: NeilBrown --- lib/rhasht

[PATCH 4/6] rhashtable: improve rhashtable_walk stability when stop/start used.

2018-04-17 Thread NeilBrown
nd the object even though it is still in the hashtable if a rehash has moved it to a new table. In this case it will (eventually) get -EAGAIN and will need to proceed through the whole table again to be sure to see everything at least once. Acked-by: Herbert Xu Signed-off-by: NeilBrown

[PATCH 1/6] rhashtable: remove outdated comments about grow_decision etc

2018-04-17 Thread NeilBrown
grow_decision and shink_decision no longer exist, so remove the remaining references to them. Signed-off-by: NeilBrown --- include/linux/rhashtable.h | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/include/linux/rhashtable.h b/include

[PATCH 2/6] rhashtable: remove incorrect comment on r{hl, hash}table_walk_enter()

2018-04-17 Thread NeilBrown
Neither rhashtable_walk_enter() or rhltable_walk_enter() sleep, so remove the comments which suggest that they do. Signed-off-by: NeilBrown --- include/linux/rhashtable.h |3 --- lib/rhashtable.c |3 --- 2 files changed, 6 deletions(-) diff --git a/include/linux/rhashtable.h

Re: [PATCH 5/6] rhashtable: support guaranteed successful insertion.

2018-04-05 Thread NeilBrown
On Thu, Mar 29 2018, Herbert Xu wrote: > On Thu, Mar 29, 2018 at 08:26:21AM +1100, NeilBrown wrote: >> >> I say "astronomically unlikely", you say "probability .. is extremely >> low". I think we are in agreement here. >> >> The point rema

Re: [Cluster-devel] [PATCH v2 0/2] gfs2: Stop using rhashtable_walk_peek

2018-04-05 Thread NeilBrown
action to ensure that the previously returned object remains in the table until the next ->start, then you can reliably walk the table with no duplicates or omissions (unless a concurrent rehash causes duplicates) If you don't keep the object in the table and it gets removed, then the 'skip' counter is used to find your place, and you might get duplicates or omissions. NeilBrown signature.asc Description: PGP signature

Re: [PATCH v2 0/2] gfs2: Stop using rhashtable_walk_peek

2018-04-02 Thread NeilBrown
_prev(struct rhashtable_iter *iter) { return iter->p; } Thoughts? Thanks, NeilBrown signature.asc Description: PGP signature

Re: [PATCH 0/2] rhashtable_walk fixes

2018-04-02 Thread NeilBrown
On Fri, Mar 30 2018, David Miller wrote: > From: NeilBrown > Date: Thu, 29 Mar 2018 12:19:09 +1100 > >> These two patches apply on top of my previous "rhashtable: reset iter >> when rhashtable_walk_start sees new table" patch. >> >> The first

[PATCH 0/2] rhashtable_walk fixes

2018-03-28 Thread NeilBrown
." This version doesn't require an API change and should be reliable for rhltables too (my first version didn't handle these correctly). Thanks, NeilBrown --- NeilBrown (2): rhashtable: fix insertion of in rhltable when duplicate found. rhashtable: improve rhashtable_walk

[PATCH 1/2] rhashtable: fix insertion of in rhltable when duplicate found.

2018-03-28 Thread NeilBrown
ant change. Signed-off-by: NeilBrown --- include/linux/rhashtable.h |4 +++- lib/rhashtable.c |4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h index c9df2527e0cd..668a21f04b09 100644 --- a/include/linux/rh

[PATCH 2/2] rhashtable: improve rhashtable_walk stability when stop/start used.

2018-03-28 Thread NeilBrown
nd the object even though it is still in the hashtable if a rehash has moved it to a new table. In this case it will (eventually) get -EAGAIN and will need to proceed through the whole table again to be sure to see everything at least once. Signed-off-by: NeilBrown

Re: [PATCH 4/6] rhashtable: allow a walk of the hash table without missing objects.

2018-03-28 Thread NeilBrown
On Thu, Mar 29 2018, NeilBrown wrote: > > How about storing the hash chains in order by object address? > Then rhashtable_walk_start() can easily find it's place regardless of > whether the old object was still present or not, using <= on the > address. > "Insert&

Re: [PATCH] gfs2: Stop using rhashtable_walk_peek

2018-03-28 Thread NeilBrown
lock_iter_next() (And hence gfs2_glock_seq_start()) will sometimes exit with gl_held true, and sometimes with it false. gfs2_glock_seq_stop() assumes that it is false. Normally gfs2_glock_seq_next() will normally be called between these two and will clear gl_held, but I don't think t

Re: [PATCH 4/6] rhashtable: allow a walk of the hash table without missing objects.

2018-03-28 Thread NeilBrown
On Wed, Mar 28 2018, Herbert Xu wrote: > On Wed, Mar 28, 2018 at 06:17:57PM +1100, NeilBrown wrote: >> >> Sounds like over-kill to me. >> It might be reasonable to have a CONFIG_DEBUG_RHASHTABLE which enables >> extra to code to catch misuse, but I don't see

Re: [PATCH 5/6] rhashtable: support guaranteed successful insertion.

2018-03-28 Thread NeilBrown
On Wed, Mar 28 2018, Herbert Xu wrote: > On Wed, Mar 28, 2018 at 06:04:40PM +1100, NeilBrown wrote: >> >> I disagree. My patch 6 only makes it common instead of exceedingly >> rare. If any table in the list other than the first has a chain with 16 >> elements, then

Re: [PATCH 4/6] rhashtable: allow a walk of the hash table without missing objects.

2018-03-28 Thread NeilBrown
On Wed, Mar 28 2018, Herbert Xu wrote: > On Wed, Mar 28, 2018 at 08:54:41AM +1100, NeilBrown wrote: >> >> Possibly. >> I particularly want the interface to require that you pass the >> previously returned object to _continue. That makes it easy to see that >> th

Re: [PATCH 5/6] rhashtable: support guaranteed successful insertion.

2018-03-28 Thread NeilBrown
On Wed, Mar 28 2018, Herbert Xu wrote: > On Wed, Mar 28, 2018 at 08:34:19AM +1100, NeilBrown wrote: >> >> It is easy to get an -EBUSY insertion failure when .disable_count is >> enabled, and I did get that. Blindly propagating that up caused lustre >> to get

Re: [PATCH 1/6] rhashtable: improve documentation for rhashtable_walk_peek()

2018-03-27 Thread NeilBrown
On Wed, Mar 28 2018, Andreas Grünbacher wrote: > Neil, > > 2018-03-27 1:33 GMT+02:00 NeilBrown : >> The documentation for rhashtable_walk_peek() wrong. It claims to >> return the *next* entry, whereas it in fact returns the *previous* >> entry. >> However if

Re: [PATCH 4/6] rhashtable: allow a walk of the hash table without missing objects.

2018-03-27 Thread NeilBrown
On Tue, Mar 27 2018, Herbert Xu wrote: > On Tue, Mar 27, 2018 at 10:33:04AM +1100, NeilBrown wrote: >> >> -int rhashtable_walk_start_check(struct rhashtable_iter *iter) >> +int rhashtable_walk_start_continue(struct rhashtable_iter *iter, struct >> rhash_head *

Re: [PATCH 4/6] rhashtable: allow a walk of the hash table without missing objects.

2018-03-27 Thread NeilBrown
On Tue, Mar 27 2018, David Miller wrote: > From: NeilBrown > Date: Tue, 27 Mar 2018 10:33:04 +1100 > >> In many cases where the walker needs to drop out of RCU protection, >> it will take a reference to the object and this can prevent it from >> being removed from the

[PATCH 1/6 v2] rhashtable: improve documentation for rhashtable_walk_peek()

2018-03-27 Thread NeilBrown
In this version I: - fixed brace-after-else coding style, thanks Sergei Shtylyov, - explained where the one user is, thanks David Miller - added CC for author of rhashtable_walk_peek (Tom Herbert) and of the one usage (Andreas Gruenbacher) - thanks Herbert Xu NeilBrown -8

Re: [PATCH 5/6] rhashtable: support guaranteed successful insertion.

2018-03-27 Thread NeilBrown
On Tue, Mar 27 2018, Herbert Xu wrote: > On Tue, Mar 27, 2018 at 10:33:04AM +1100, NeilBrown wrote: >> The current rhashtable will fail an insertion if the hashtable >> it "too full", one of: >> - table already has 2^31 elements (-E2BIG) >> - a max_size was

[PATCH 0/6] rhashtable: assorted fixes and enhancements

2018-03-26 Thread NeilBrown
go in through the netdev tree if you prefer - the last 4 are needed for lustre to work correctly/optimally. Thanks, NeilBrown --- NeilBrown (6): rhashtable: improve documentation for rhashtable_walk_peek() rhashtable: remove outdated comments about grow_decision etc rhashtable:

[PATCH 1/6] rhashtable: improve documentation for rhashtable_walk_peek()

2018-03-26 Thread NeilBrown
the documentation can be correct without listing too many special cases. I don't think the one user will be affected by the code change. Signed-off-by: NeilBrown --- lib/rhashtable.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/rhashtable.c

[PATCH 4/6] rhashtable: allow a walk of the hash table without missing objects.

2018-03-26 Thread NeilBrown
able will return every object that was in the hastable for the duration of the walk, at least once. This can be used, for example, to selectively delete objects from the table. Signed-off-by: NeilBrown --- include/linux/rhashtable.h | 28 ++-- lib/rhashtable.c

[PATCH 3/6] rhashtable: reset intr when rhashtable_walk_start sees new table

2018-03-26 Thread NeilBrown
The documentation claims that when rhashtable_walk_start_check() detects a resize event, it will rewind back to the beginning of the table. This is not true. We need to set ->slot and ->skip to be zero for it to be true. Signed-off-by: NeilBrown --- lib/rhashtable.c |2 ++ 1 file c

[PATCH 5/6] rhashtable: support guaranteed successful insertion.

2018-03-26 Thread NeilBrown
ing the new ->long_chain without locking cannot cause any corruption. Signed-off-by: NeilBrown --- include/linux/rhashtable.h | 18 +++--- lib/rhashtable.c | 27 +++ 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/include/lin

[PATCH 2/6] rhashtable: remove outdated comments about grow_decision etc

2018-03-26 Thread NeilBrown
grow_decision and shink_decision no longer exist, so remove the remaining references to them. Signed-off-by: NeilBrown --- include/linux/rhashtable.h | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/include/linux/rhashtable.h b/include

[PATCH 6/6] rhashtable: allow element counting to be disabled.

2018-03-26 Thread NeilBrown
ver to decrease it. If a client wants minimal contention while still maintaining a shorter chain length, it can run a periodic task which counts the number of elements and updates ->nelems directly. Signed-off-by: NeilBrown --- include/linux/rhashtable.h | 26 ++ lib/r

[PATCH] net/sunrpc/xprt_sock: fix regression in connection error reporting.

2017-07-18 Thread NeilBrown
poll() flakes when receiving RST") Cc: sta...@vger.kernel.org (v4.12) Signed-off-by: NeilBrown --- net/sunrpc/xprtsock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index d5b54c020dec..4f154d388748 100644 --- a/net/sunrpc/xprtsock.c +++

[PATCH 003 of 3] knfsd: Remove CONFIG_IPV6 ifdefs from sunrpc server code.

2007-03-01 Thread NeilBrown
They don't really save that much, and aren't worth the hassle. Signed-off-by: Neil Brown <[EMAIL PROTECTED]> ### Diffstat output ./include/linux/sunrpc/svc.h |2 -- ./net/sunrpc/svcsock.c | 13 +++-- 2 files changed, 3 insertions(+), 12 deletions(-) diff .prev/include/linux

[PATCH 002 of 3] knfsd: Avoid checksum checks when collecting metadata for a UDP packet.

2007-03-01 Thread NeilBrown
When recv_msg is called with a size of 0 and MSG_PEEK (and sunrpc/svcsock.c does), it is clear that we only interested in metadata (from/to addresses) and not the data, so don't do any checksum checking at this point. Leave that until the data is requested. Signed-off-by: Neil Brown <[EMAIL PROT

[PATCH 001 of 3] knfsd: Use recv_msg to get peer address for NFSD instead of code-copying

2007-03-01 Thread NeilBrown
The sunrpc server code needs to know the source and destination address for UDP packets so it can reply properly. It currently copies code out of the network stack to pick the pieces out of the skb. This is ugly and causes compile problems with the IPv6 stuff. So, rip that out and use recv_msg i

[PATCH 000 of 3] knfsd: Resolve IPv6 related link error

2007-03-01 Thread NeilBrown
small optimisation. Finally the last patch removes all the #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) from sunrpc as it really isn't needed and just hides this sort of problem. Patches 1 and 3 are suitable for 2.6.21. Patch 2 needs confirmation. Thanks, NeilBrown [PATC