From patchwork Sat Feb 27 00:25:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 8443361 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 494C4C0553 for ; Sat, 27 Feb 2016 00:49:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4CD19203F1 for ; Sat, 27 Feb 2016 00:49:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 61E27203EC for ; Sat, 27 Feb 2016 00:49:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755577AbcB0Asv (ORCPT ); Fri, 26 Feb 2016 19:48:51 -0500 Received: from mail-pf0-f172.google.com ([209.85.192.172]:35231 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755218AbcB0Asu (ORCPT ); Fri, 26 Feb 2016 19:48:50 -0500 Received: by mail-pf0-f172.google.com with SMTP id w128so12653453pfb.2 for ; Fri, 26 Feb 2016 16:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=3F726c1kN0f3DR1w5GScy4egVt0H4w4UaYxI9r7eIe8=; b=MX6pnD3VvxXaeKS+0Sx3V6B8EOgsL0JTAnndoR4SxRxTN5H1rM9qdw2DEsAmWxjn9V P5tlk1K0YdnXx1kM6t8RO6GGXlSuAH5U/WGLnqx9mBwpMrU07w6tjXmQkiXj7I70Z8M/ XH5GpnTKnSLlAnBN98PxRqvUkyjjKQb6kP+Mc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3F726c1kN0f3DR1w5GScy4egVt0H4w4UaYxI9r7eIe8=; b=maaB/jfOsVStnLyW6FtgvMcdcHfrR57YR3dIf96aGAKab7JCLDzB7gQQJN6SoivTJ4 2TGMCvPIXbgh7WypuL8bMejDz5kvhrQRrtenz+uwn0m7k0dJGeFdedOWlFee9hM+DxPL UFMC2qdR3Q8eISSbooLLIQc3T8TgrmwVxalQkcDfycWf3qHJGmD8KMwN6DCwVfyPA9j4 1yYCq1XbV2mn2eN39Xxlr/5kyLm34LhDT6Y1cEbMfNXJkE3xaYIaOGDlqMilLnQXXrns OPquPmES2IXfyC1KvuhYbpzOrzcDbq8uj9c1zyE2b/CmG1O9lTe8DsC3rFmE6vgZGtI3 wbCA== X-Gm-Message-State: AD7BkJLy0dp3yqBboNrSbBnWD8zQF+tLOdsXXRY6B5Vo7/et9VHYnt+i929ZCD9r4QWHlZke X-Received: by 10.98.67.67 with SMTP id q64mr6323740pfa.44.1456534129801; Fri, 26 Feb 2016 16:48:49 -0800 (PST) Received: from yshi-Precision-T5600.corp.ad.wrs.com (unknown-216-82.windriver.com. [147.11.216.82]) by smtp.gmail.com with ESMTPSA id o17sm21846467pfj.50.2016.02.26.16.48.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Feb 2016 16:48:49 -0800 (PST) From: Yang Shi To: jaegeuk@kernel.org, cm224.lee@samsung.com, chao2.yu@samsung.com, tglx@linutronix.de, rostedt@goodmis.org, bigeasy@linutronix.de Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-rt-users@vger.kernel.org, linaro-kernel@lists.linaro.org, yang.shi@linaro.org Subject: [PATCH] f2fs: mutex can't be used by down_write_nest_lock() Date: Fri, 26 Feb 2016 16:25:25 -0800 Message-Id: <1456532725-4126-1-git-send-email-yang.shi@linaro.org> X-Mailer: git-send-email 2.0.2 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 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); ^ fs/f2fs/f2fs.h:27:55: note: in definition of macro 'f2fs_down_write' #define f2fs_down_write(x, y) down_write_nest_lock(x, y) ^ In file included from include/linux/rwsem.h:22:0, from fs/f2fs/xattr.c:21: include/linux/rwsem_rt.h:138:20: note: expected 'struct rw_semaphore *' but argument is of type 'struct mutex *' static inline void down_write_nest_lock(struct rw_semaphore *sem, Signed-off-by: Yang Shi Reviewed-by: Chao Yu --- 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 ff79054..af77c1a 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -25,7 +25,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 { \ @@ -34,7 +33,6 @@ set_sbi_flag(sbi, SBI_NEED_FSCK); \ } \ } while (0) -#define f2fs_down_write(x, y) down_write(x) #endif /* @@ -1006,7 +1004,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)