LKML Archive on
help / color / mirror / Atom feed
From: Stephane Chazelas <>
To: "Jörn Engel" <>
	Arnd Bergmann <>
Subject: Re: [PATCH 2.6.24] block2mtd: removing a device and typo fixes
Date: Wed, 20 Feb 2008 14:36:46 +0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

2008-02-19 16:08:22 +0100, Jörn Engel:
> [ Just returned home. ]

Hi Jörn,

I've got to admit I've been a little too busy to look at it
myself. I'll send a patch for the obvious fixes soon though.

> > Well, yes that raised a concern to me, the "exit" function
> > returns "void". If the del_mtd_device fails with EBUSY at the
> > moment (such as when a /dev/mtdblock<x> is mounted), we ignore
> > it and go on with freeing everything leaving a dangling mtd.
> > 
> > Is there a way around that?
> For module unload we should be safe.  Errors are only returned if the
> device doesn't exist (a clear bug) or if the device is still being used.
> Module refcounting should prevent the latter case, so either way we have
> a bug if del_mtd_device returns an error.

At the moment, when we bind a mtd device to a block device, we
don't increase the refcount. When a mtdblock on a block2mtd, the
refcount is not increased either (the mtdblock's one is I

When you unload block2mtd, the block2mtd exit code tries and
remove the mtd bindings. If it fails, it exits anyway, leaving
some dangling stuff. That's why I suggested that the exit code
doesn't do the cleaning but that the requirement of cleaning
things up is  put upon the user before he is allowed to unload
the module (increasing the refcount every time block2mtd is used
to map a mtd to a block device).

> When removing the device via your proposed interface we should simply
> return the error to userspace, if the interface permits.  Sysfs doesn't
> seem to permit error returns, so we should keep the device alive and do
> nothing.

Agreed, that's what I was doing in my patch. But I wasn't doing
anything with the refcount, this was still handled as before,
that is we relied on the exit code to do the clean up.

Best regards,

  parent reply	other threads:[~2008-02-20 14:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-12 13:47 Stephane Chazelas
2008-02-12 15:21 ` Jörn Engel
2008-02-12 16:10   ` Stephane Chazelas
2008-02-19 15:08     ` Jörn Engel
2008-02-19 22:33       ` Arnd Bergmann
2008-02-20  6:43         ` Jörn Engel
2008-02-20 14:43         ` Stephane Chazelas
2008-02-20 16:30           ` Jörn Engel
2008-02-20 17:02             ` Stephane Chazelas
2008-02-20 17:22               ` Jörn Engel
2008-02-20 17:30                 ` Stephane Chazelas
2008-02-23 15:33                   ` Jörn Engel
2008-02-20 14:36       ` Stephane Chazelas [this message]
2008-02-20 16:42         ` Jörn Engel
2008-02-20 16:55           ` Stephane Chazelas

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:

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

  git send-email \ \ \ \ \ \ \
    --subject='Re: [PATCH 2.6.24] block2mtd: removing a device and typo fixes' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).