# RE: \[PATCH 1/2\] rhashtable: Introduce rhashtable\_walk\_\*

- From: David Laight \<hidden\>
- Date: 2015-01-27 10:09:34 
- List: netdev
- Page: https://ratatoskr.run/netdev/2015/01/10976437
- Thread: https://ratatoskr.run/netdev/2015/01/10975759/t.md

```text
From: Herbert Xu 
> On Mon, Jan 26, 2015 at 10:09:24AM +0000, David Laight wrote:
> >
> > That doesn't look right to me.
> > Surely you shouldn't be calling rcu_read_lock() when the mutex
> > request is interrupted.
> >
> > So maybe:
> > 	err = mutex_lock_interruptible(&ht->mutex);
> > 	if (err)
> > 		return err;
> > 	rcu_read_lock();
> 
> No, we need to grab the RCU read lock while holding the mutex
> in order to prevent future resizes from happening once we release
> the mutex.

But if err is non-zero you don't hold the mutex.
Presumably the calling code also errors out immediately,
so the RCU lock isn't needed at all.

	David
```
