All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] md: setup safemode_timer before it's being used
Date: Mon, 27 Jul 2015 11:30:35 +1000	[thread overview]
Message-ID: <20150727113035.40029611@noble> (raw)
In-Reply-To: <1437776398-31079-1-git-send-email-sasha.levin@oracle.com>

On Fri, 24 Jul 2015 18:19:58 -0400 Sasha Levin <sasha.levin@oracle.com>
wrote:

> We used to set up the safemode_timer timer in md_run. If md_run
> would fail before the timer was set up we'd end up trying to modify
> a timer that doesn't have a callback function when we access safe_delay_store,
> which would trigger a BUG.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  drivers/md/md.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 80879dc..60fb47e 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -502,6 +502,8 @@ static void mddev_put(struct mddev *mddev)
>  		bioset_free(bs);
>  }
>  
> +static void md_safemode_timeout(unsigned long data);
> +
>  void mddev_init(struct mddev *mddev)
>  {
>  	mutex_init(&mddev->open_mutex);
> @@ -510,6 +512,8 @@ void mddev_init(struct mddev *mddev)
>  	INIT_LIST_HEAD(&mddev->disks);
>  	INIT_LIST_HEAD(&mddev->all_mddevs);
>  	init_timer(&mddev->safemode_timer);
> +	setup_timer(&mddev->safemode_timer, md_safemode_timeout,
> +			(unsigned long) mddev);
>  	atomic_set(&mddev->active, 1);
>  	atomic_set(&mddev->openers, 0);
>  	atomic_set(&mddev->active_io, 0);
> @@ -3276,8 +3280,6 @@ int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale)
>  	return 0;
>  }
>  
> -static void md_safemode_timeout(unsigned long data);
> -
>  static ssize_t
>  safe_delay_show(struct mddev *mddev, char *page)
>  {
> @@ -5204,8 +5206,6 @@ int md_run(struct mddev *mddev)
>  	atomic_set(&mddev->max_corr_read_errors,
>  		   MD_DEFAULT_MAX_CORRECTED_READ_ERRORS);
>  	mddev->safemode = 0;
> -	mddev->safemode_timer.function = md_safemode_timeout;
> -	mddev->safemode_timer.data = (unsigned long) mddev;
>  	mddev->safemode_delay = (200 * HZ)/1000 +1; /* 200 msec delay */
>  	mddev->in_sync = 1;
>  	smp_wmb();


Thanks.
I've applied that patch, and also removed the 'init_timer' call which
is now not needed as setup_timer does that.

Thanks,
NeilBrown

      reply	other threads:[~2015-07-27  1:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 22:19 [PATCH] md: setup safemode_timer before it's being used Sasha Levin
2015-07-27  1:30 ` NeilBrown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150727113035.40029611@noble \
    --to=neilb@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=sasha.levin@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.