public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind@infradead.org>
To: dpervushin@embeddedalley.com
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] [UBI] [1/3] ubi notifications API
Date: Mon, 18 May 2009 11:05:29 +0300	[thread overview]
Message-ID: <1242633929.27996.271.camel@localhost.localdomain> (raw)
In-Reply-To: <1241018978.20184.33.camel@hp.diimka.lan>

On Wed, 2009-04-29 at 19:29 +0400, dmitry pervushin wrote:
> +/**
> + * ubi_register_volume_notifier - register the volume notification function.
> + * @nb: pointer to the filled struct &notifier_block
> + * @ignore_existing: boolean flag; if set to 1, UBI will not send notifications
> + * 		     about ADDing existing volumes
> + *
> + * The function @nb.notifier_call will be called when volume is added,
> + * removed, resized or renamed. Its first parameter is &enum
> + * ubi_volume_notification_type, and the second points to the structure
> + * that contains information about "changed" volume - ubi_num and
> + * volume_id. When the notifier is called, it is safe to use all UBI API.
> + *
> + * Returns %0 on success, error code otherwise.
> + */
> +int ubi_register_volume_notifier(struct notifier_block *nb,
> +				 int ignore_existing)
> +{
> +	int err;
> +
> +	err = blocking_notifier_chain_register(&ubi_notifiers, nb);
> +	if (err != 0)
> +		return err;
> +	if (ignore_existing)
> +		return err;
> +	down_read(&ubi_notifiers.rwsem);
> +
> +	ubi_enum_all_volumes(UBI_VOLUME_ADDED, nb);
> +	up_read(&ubi_notifiers.rwsem);
> +	return err;
> +}

You take the rwsem here. Then:
'ubi_enum_all_volumes()' ->
'ubi_enum_volumes()' ->
'blocking_notifier_call_chain()' ->
'blocking_notifier_call_chain()'

and down_read(&nh->rwsem);

Deadlock. Have you tested your code?

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

  parent reply	other threads:[~2009-05-18  8:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-29 15:29 [PATCH] [UBI] [1/3] ubi notifications API dmitry pervushin
2009-05-06  6:31 ` Artem Bityutskiy
2009-05-07  6:14 ` Artem Bityutskiy
2009-05-18  8:05 ` Artem Bityutskiy [this message]
2009-05-18 15:22 ` Artem Bityutskiy
2009-05-18 15:26   ` [PATCH] UBI: add notification API Artem Bityutskiy
2009-05-18 15:28     ` [PATCH] UBI: remove built-in gluebi Artem Bityutskiy
2009-05-18 15:39   ` [PATCH] [UBI] [1/3] ubi notifications API Artem Bityutskiy
2009-05-29 19:27     ` [PATCH] 3/3 ubi notification API " dmitry pervushin
2009-05-31 13:52       ` Artem Bityutskiy
2009-05-31 14:32         ` [PATCH] 3/3 ubi notification API (was Re: [PATCH] [UBI] [1/3] ubi notifications API) dmitry pervushin
2009-06-01 16:48           ` Artem Bityutskiy
2009-06-01 17:07             ` dmitry pervushin
2009-06-02  6:40               ` Artem Bityutskiy
2009-05-31 14:06       ` [PATCH] 3/3 ubi notification API Re: [PATCH] [UBI] [1/3] ubi notifications API Artem Bityutskiy

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=1242633929.27996.271.camel@localhost.localdomain \
    --to=dedekind@infradead.org \
    --cc=dpervushin@embeddedalley.com \
    --cc=linux-mtd@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox