From patchwork Thu Oct 5 00:52:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 821554 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="O2npg4Pj"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y6vXd3TDcz9s7M for ; Thu, 5 Oct 2017 11:58:41 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752915AbdJEAxB (ORCPT ); Wed, 4 Oct 2017 20:53:01 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:51480 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752896AbdJEAw5 (ORCPT ); Wed, 4 Oct 2017 20:52:57 -0400 Received: by mail-pg0-f52.google.com with SMTP id u144so4723697pgb.8 for ; Wed, 04 Oct 2017 17:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=uCsfyrwDLreWTkoRVVQCwv2qOxMrEkQdI4mFt5lTPmw=; b=O2npg4PjXpC8q3o1ZfjMhz6uBem0wHuBxp3w5HcBzxKhS2LthtYP7qXrUza54+IZXU +bIkyzmvo9sfGbcE9baOGZc4EYG53kkhQdlbqaISUuGRMx+tPBvIKafokU6VPZAIi5hN 75a+PVnxme6hMIGhljySG8ZauHkKeNR/Q/MrY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=uCsfyrwDLreWTkoRVVQCwv2qOxMrEkQdI4mFt5lTPmw=; b=RgIKS5BNGnn2tytgtUPU7w4YdFh5EZYySR4Lhi1cKy1+W4Upe7WsPpiAt4nEHsxVp1 kC9lkXiql8y90JLvZmvFJjXQsRRF4qijBAl8JUpyL7nRrRDjHH6I2Dgwr/QUsf/ofEVk lf0sRrNmrp/x6uUPxUcCuAMHGqzPDuZu1FZ62AIZG8vnEh1olWtHvkoo71SqrLsvNtqq 1mQ5XLvTJI311lQy6TwUiiVTxwZcQ/Ojc+jdjyKUiGf8fqVRIJOexWxSKB/uNg7mO8Y0 xTwrbkY5xuZs5JjtBC8mpVcYzvjDycq1KdZkzDnHyxtEZ5m12LwRIMVsFU/pNgZBfQH8 44RA== X-Gm-Message-State: AMCzsaW0zr6VKBGidf6dSJ4xhRjhr2xwgl8OenjYvCzxIyyceP7bZOZh lJjY1QrDRnNaJMNyHlHiybA7eQ== X-Google-Smtp-Source: AOwi7QBO0Xnmh8BEJZoaE9EvY6mc6p3rc0KSzFLH9tJkt78vzGQvQwU8l6kV74CoGsgpaJ/rVmxpTg== X-Received: by 10.99.100.134 with SMTP id y128mr8899217pgb.45.1507164776726; Wed, 04 Oct 2017 17:52:56 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id u20sm26677705pfh.171.2017.10.04.17.52.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 17:52:55 -0700 (PDT) Date: Wed, 4 Oct 2017 17:52:54 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Theodore Ts'o , Andreas Dilger , linux-ext4@vger.kernel.org, Thomas Gleixner Subject: [PATCH] ext4: Convert timers to use timer_setup() Message-ID: <20171005005254.GA23668@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: "Theodore Ts'o" Cc: Andreas Dilger Cc: linux-ext4@vger.kernel.org Cc: Thomas Gleixner Signed-off-by: Kees Cook Reviewed-by: Jan Kara --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- fs/ext4/super.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index b104096fce9e..1bc7ff8157d8 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2791,14 +2791,11 @@ static int ext4_feature_set_ok(struct super_block *sb, int readonly) * This function is called once a day if we have errors logged * on the file system */ -static void print_daily_error_info(unsigned long arg) +static void print_daily_error_info(struct timer_list *t) { - struct super_block *sb = (struct super_block *) arg; - struct ext4_sb_info *sbi; - struct ext4_super_block *es; - - sbi = EXT4_SB(sb); - es = sbi->s_es; + struct ext4_sb_info *sbi = from_timer(sbi, t, s_err_report); + struct super_block *sb = sbi->s_sb; + struct ext4_super_block *es = sbi->s_es; if (es->s_error_count) /* fsck newer than v1.41.13 is needed to clean this condition. */ @@ -3980,8 +3977,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) get_random_bytes(&sbi->s_next_generation, sizeof(u32)); spin_lock_init(&sbi->s_next_gen_lock); - setup_timer(&sbi->s_err_report, print_daily_error_info, - (unsigned long) sb); + timer_setup(&sbi->s_err_report, print_daily_error_info, 0); /* Register extent status tree shrinker */ if (ext4_es_register_shrinker(sbi))