From patchwork Wed Mar 2 15:09:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 8481611 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3FAE8C0553 for ; Wed, 2 Mar 2016 15:12:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4CA852011B for ; Wed, 2 Mar 2016 15:12:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5BB8920383 for ; Wed, 2 Mar 2016 15:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754728AbcCBPLX (ORCPT ); Wed, 2 Mar 2016 10:11:23 -0500 Received: from mail.kernel.org ([198.145.29.136]:55132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754705AbcCBPLT (ORCPT ); Wed, 2 Mar 2016 10:11:19 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 90DAC2037C; Wed, 2 Mar 2016 15:11:17 +0000 (UTC) Received: from gandalf.local.home (cpe-67-246-153-56.stny.res.rr.com [67.246.153.56]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DAEAF203EC; Wed, 2 Mar 2016 15:11:14 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.86) (envelope-from ) id 1ab8Qj-00082X-Ju; Wed, 02 Mar 2016 10:11:13 -0500 Message-Id: <20160302151113.554132593@goodmis.org> User-Agent: quilt/0.61-1 Date: Wed, 02 Mar 2016 10:09:18 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-rt-users Cc: Thomas Gleixner , Carsten Emde , Sebastian Andrzej Siewior , John Kacur , Paul Gortmaker , Yang Shi , , , , , , Subject: [PATCH RT 19/22] f2fs: Mutex cant be used by down_write_nest_lock() References: <20160302150859.204542604@goodmis.org> MIME-Version: 1.0 Content-Disposition: inline; filename=0019-f2fs-Mutex-can-t-be-used-by-down_write_nest_lock.patch X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 4.1.15-rt18-rc1 stable review patch. If anyone has any objections, please let me know. ------------------ From: Yang Shi fsf2_lock_all() calls down_write_nest_lock() to acquire a rw_sem and check a mutex, but down_write_nest_lock() is designed for two rw_sem accoring to the comment in include/linux/rwsem.h. And, other than f2fs, it is just called in mm/mmap.c with two rwsem. So, it looks it is used wrongly by f2fs. And, it causes the below compile warning on -rt kernel too. In file included from fs/f2fs/xattr.c:25:0: fs/f2fs/f2fs.h: In function 'f2fs_lock_all': fs/f2fs/f2fs.h:962:34: warning: passing argument 2 of 'down_write_nest_lock' from incompatible pointer type [-Wincompatible-pointer-types] f2fs_down_write(&sbi->cp_rwsem, &sbi->cp_mutex); ^ The nest annotation was anyway bogus as nested annotations for lockdep are only required if one nests two locks of the same lock class, which is not the case here. Signed-off-by: Yang Shi Cc: cm224.lee@samsung.com Cc: chao2.yu@samsung.com Cc: linaro-kernel@lists.linaro.org Cc: linux-rt-users@vger.kernel.org Cc: bigeasy@linutronix.de Cc: rostedt@goodmis.org Cc: linux-f2fs-devel@lists.sourceforge.net Cc: linux-fsdevel@vger.kernel.org Cc: jaegeuk@kernel.org Link: http://lkml.kernel.org/r/1456532725-4126-1-git-send-email-yang.shi@linaro.org Signed-off-by: Thomas Gleixner Signed-off-by: Steven Rostedt --- fs/f2fs/f2fs.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 8de34ab6d5b1..4e80270703a4 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -22,7 +22,6 @@ #ifdef CONFIG_F2FS_CHECK_FS #define f2fs_bug_on(sbi, condition) BUG_ON(condition) -#define f2fs_down_write(x, y) down_write_nest_lock(x, y) #else #define f2fs_bug_on(sbi, condition) \ do { \ @@ -31,7 +30,6 @@ set_sbi_flag(sbi, SBI_NEED_FSCK); \ } \ } while (0) -#define f2fs_down_write(x, y) down_write(x) #endif /* @@ -838,7 +836,7 @@ static inline void f2fs_unlock_op(struct f2fs_sb_info *sbi) static inline void f2fs_lock_all(struct f2fs_sb_info *sbi) { - f2fs_down_write(&sbi->cp_rwsem, &sbi->cp_mutex); + down_write(&sbi->cp_rwsem); } static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi)