diff mbox

locking/rwsem: Fix up_read_non_owner() warning with DEBUG_RWSEMS

Message ID 1527168398-4291-1-git-send-email-longman@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Waiman Long May 24, 2018, 1:26 p.m. UTC
It was found that the use of up_read_non_owner() in NFS was causing
the following warning when DEBUG_RWSEMS was configured.

  DEBUG_LOCKS_WARN_ON(sem->owner != ((struct task_struct *)(1UL << 0)))

Looking into the rwsem.c file, it was discovered that the corresponding
down_read_non_owner() function was not setting the owner field properly.
This is fixed now, and the warning should be gone.

Signed-off-by: Waiman Long <longman@redhat.com>
---
 kernel/locking/rwsem.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Waiman Long June 19, 2018, 11:09 p.m. UTC | #1
On 05/24/2018 09:26 PM, Waiman Long wrote:
> It was found that the use of up_read_non_owner() in NFS was causing
> the following warning when DEBUG_RWSEMS was configured.
>
>   DEBUG_LOCKS_WARN_ON(sem->owner != ((struct task_struct *)(1UL << 0)))
>
> Looking into the rwsem.c file, it was discovered that the corresponding
> down_read_non_owner() function was not setting the owner field properly.
> This is fixed now, and the warning should be gone.
>
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
>  kernel/locking/rwsem.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
> index bc1e507..776308d 100644
> --- a/kernel/locking/rwsem.c
> +++ b/kernel/locking/rwsem.c
> @@ -181,6 +181,7 @@ void down_read_non_owner(struct rw_semaphore *sem)
>  	might_sleep();
>  tch
>  	__down_read(sem);
> +	rwsem_set_reader_owned(sem);
>  }
>  
>  EXPORT_SYMBOL(down_read_non_owner);

Since the 4.18 merge window has been closed. Can that patch be merged
upstream?

Cheers,
Longman

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Schenk, Gavin June 20, 2018, 5:49 a.m. UTC | #2
Hi,

On Wed, 2018-06-20 at 07:09 +0800, Waiman Long wrote:
> On 05/24/2018 09:26 PM, Waiman Long wrote:

> > It was found that the use of up_read_non_owner() in NFS was causing

> > the following warning when DEBUG_RWSEMS was configured.

> > 

> >   DEBUG_LOCKS_WARN_ON(sem->owner != ((struct task_struct *)(1UL << 0)))

> > 

> > Looking into the rwsem.c file, it was discovered that the corresponding

> > down_read_non_owner() function was not setting the owner field properly.

> > This is fixed now, and the warning should be gone.

> > 

> > Signed-off-by: Waiman Long <longman@redhat.com>

Tested-by: Gavin Schenk <g.schenk@eckelmann.de>


This fixes my reproducible locking splat when booting with nfsroot and changing password. Thank you!

Regards
Gavin Schenk
Peter Zijlstra June 20, 2018, 9:17 a.m. UTC | #3
On Thu, May 24, 2018 at 09:26:38AM -0400, Waiman Long wrote:
> It was found that the use of up_read_non_owner() in NFS was causing
> the following warning when DEBUG_RWSEMS was configured.
> 
>   DEBUG_LOCKS_WARN_ON(sem->owner != ((struct task_struct *)(1UL << 0)))
> 
> Looking into the rwsem.c file, it was discovered that the corresponding
> down_read_non_owner() function was not setting the owner field properly.
> This is fixed now, and the warning should be gone.
> 
> Signed-off-by: Waiman Long <longman@redhat.com>

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

> ---
>  kernel/locking/rwsem.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
> index bc1e507..776308d 100644
> --- a/kernel/locking/rwsem.c
> +++ b/kernel/locking/rwsem.c
> @@ -181,6 +181,7 @@ void down_read_non_owner(struct rw_semaphore *sem)
>  	might_sleep();
>  
>  	__down_read(sem);
> +	rwsem_set_reader_owned(sem);
>  }
>  
>  EXPORT_SYMBOL(down_read_non_owner);
> -- 
> 1.8.3.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
index bc1e507..776308d 100644
--- a/kernel/locking/rwsem.c
+++ b/kernel/locking/rwsem.c
@@ -181,6 +181,7 @@  void down_read_non_owner(struct rw_semaphore *sem)
 	might_sleep();
 
 	__down_read(sem);
+	rwsem_set_reader_owned(sem);
 }
 
 EXPORT_SYMBOL(down_read_non_owner);