From patchwork Sun May 13 16:04:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Nesterov X-Patchwork-Id: 10396301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6D45060215 for ; Sun, 13 May 2018 16:04:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BEF62893E for ; Sun, 13 May 2018 16:04:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C9DD28AD1; Sun, 13 May 2018 16:04:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EFDC2893E for ; Sun, 13 May 2018 16:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751985AbeEMQEK (ORCPT ); Sun, 13 May 2018 12:04:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53420 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751584AbeEMQEJ (ORCPT ); Sun, 13 May 2018 12:04:09 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DEDEA4015A47; Sun, 13 May 2018 16:04:08 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.34.27.30]) by smtp.corp.redhat.com (Postfix) with SMTP id 8A0BA1102E20; Sun, 13 May 2018 16:04:05 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sun, 13 May 2018 18:04:08 +0200 (CEST) Date: Sun, 13 May 2018 18:04:04 +0200 From: Oleg Nesterov To: Amir Goldstein Cc: Waiman Long , Ingo Molnar , linux-fsdevel , linux-kernel , Jan Kara , Al Viro Subject: Re: DEBUG_RWSEMS warning from thaw_super() Message-ID: <20180513160404.GA19620@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sun, 13 May 2018 16:04:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sun, 13 May 2018 16:04:08 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'oleg@redhat.com' RCPT:'' Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 05/13, Amir Goldstein wrote: > > Since kernel v4.17-rc1 and DEBUG_RWSEMS, I see the > warning below after filesystem freeze/thaw. > > This is a case where one process acquires a bunch of rwsem > and another process releases them. > > To convey this use case to lockdep, freeze_super() calls > lockdep_sb_freeze_release() on exit and thaw_super() > calls lockdep_sb_freeze_acquire() on entry. This was already discussed, but I forgot the result... So once again, why we can't simply update percpu_rwsem_acquire() ? Or we can check CONFIG_RWSEM_SPIN_ON_OWNER to match percpu_rwsem_release(), but CONFIG_DEBUG_RWSEMS explains the purpose better. Oleg. Acked-by: Jan Kara --- x/include/linux/percpu-rwsem.h +++ x/include/linux/percpu-rwsem.h @@ -141,6 +141,10 @@ static inline void percpu_rwsem_acquire( bool read, unsigned long ip) { lock_acquire(&sem->rw_sem.dep_map, 0, 1, read, 1, NULL, ip); +#ifdef CONFIG_DEBUG_RWSEMS + if (!read) + sem->rw_sem.owner = current; +#endif } #endif