public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind@infradead.org>
To: dpervushin@gmail.com
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] [UBI] 1/4 UBI volume notifications - UBI changes
Date: Thu, 11 Dec 2008 21:20:16 +0200	[thread overview]
Message-ID: <1229023216.13686.391.camel@sauron> (raw)
In-Reply-To: <1228987532.7622.66.camel@hp.diimka.lan>

On Thu, 2008-12-11 at 12:25 +0300, dmitry pervushin wrote:
> > > > I do not understand this change. The point is to prevent anyone from
> > > > opening the volume before it is completely initialized. What you do -
> > > > you allow the volume to be opened while it is in the middle of
> > > > initialization, which is wrong. E.g., what if the initialization fails
> > > > at some point?
> > > > 
> > > > And this change does not seem to be relevant to this patch.
> > > This change is absolutely needed :)
> > > Well, the sequence of steps is as follows:
> > > 1. uif_init calls ubi_add_volume
> > > 2. ubi_add_volume notifies everyone about volume adding
> > > 3. (successful exit is not interested to us)
> > > 4. in case of errors reported by uif_init ubi_attach_mtd_dev calls
> > > ubi_kill_volumes
> > > 5. ubi_kill_volumes calls ubi_free_volume, which notifies everyone about
> > > volume deleting.
> 
> Isn't it better then to protect the critical section in uif_init and
> open_volume by mutexes?

May be. If you need this, feel free to send a patch. But it would not
give you much, because you would have to call your notifiers _outside_
the mutexes, i.e. at the very end of the attach function.

>  Now it looks as you are adding volumes on
> non-existing-yet device.

Right. For a short period of time during the attach process you may see
volumes which you cannot really open (you get -ENODEV). That was not a
problem so far, and it was just easier to implement things this way.

If you want to improve this and make the opening processes wait on a
mutex - please, go ahead. But I doubt you really need this.

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

  reply	other threads:[~2008-12-11 19:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-08 17:59 [PATCH] [UBI] 1/4 UBI volume notifications - UBI changes dmitry pervushin
2008-12-09 10:36 ` Artem Bityutskiy
2008-12-10 19:50   ` dmitry pervushin
2008-12-11  6:07     ` Artem Bityutskiy
2008-12-11  9:25       ` dmitry pervushin
2008-12-11 19:20         ` Artem Bityutskiy [this message]
2008-12-15 11:13           ` dmitry pervushin

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=1229023216.13686.391.camel@sauron \
    --to=dedekind@infradead.org \
    --cc=dpervushin@gmail.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