From patchwork Fri Oct 30 13:48:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Kosina X-Patchwork-Id: 7527021 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 56C0B9F2F7 for ; Fri, 30 Oct 2015 13:48:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8DF33206E4 for ; Fri, 30 Oct 2015 13:48:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A940B206B2 for ; Fri, 30 Oct 2015 13:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966137AbbJ3NsJ (ORCPT ); Fri, 30 Oct 2015 09:48:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:36633 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758979AbbJ3NsH (ORCPT ); Fri, 30 Oct 2015 09:48:07 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8F5C5AC27; Fri, 30 Oct 2015 13:48:27 +0000 (UTC) Date: Fri, 30 Oct 2015 14:48:07 +0100 (CET) From: Jiri Kosina X-X-Sender: jkosina@pobox.suse.cz To: "Rafael J. Wysocki" , Dave Chinner , Jan Kara , Christoph Hellwig , Linus Torvalds , Al Viro , Tejun Heo , Pavel Machek cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 3/3] freezer: warn if anyone is trying to use freezer on kthreads In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.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 From: Jiri Kosina kthread freezing has been deprecated in favor of fs freezing. Issue a warning if anyone attempts to still use this API. Signed-off-by: Jiri Kosina --- include/linux/freezer.h | 2 ++ kernel/freezer.c | 1 + 2 files changed, 3 insertions(+) diff --git a/include/linux/freezer.h b/include/linux/freezer.h index 81335f6..c0bc520 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h @@ -59,6 +59,8 @@ static inline bool try_to_freeze_unsafe(void) static inline bool try_to_freeze(void) { + WARN_ON(current->flags & PF_KTHREAD); + if (!(current->flags & PF_NOFREEZE)) debug_check_no_locks_held(); return try_to_freeze_unsafe(); diff --git a/kernel/freezer.c b/kernel/freezer.c index a8900a3..fe2afb9 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -164,6 +164,7 @@ void __thaw_task(struct task_struct *p) bool set_freezable(void) { might_sleep(); + WARN_ON(current->flags & PF_KTHREAD); /* * Modify flags while holding freezer_lock. This ensures the