From: Jan Kara <jack@suse.cz>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
David Woodhouse <dwmw2@infradead.org>,
linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org,
David Howells <dhowells@redhat.com>,
Bernd Schmidt <bernd.schmidt@analog.com>,
Alexander Shishkin <virtuoso@slind.org>
Subject: Re: [BUG] Rewriting backing_dev_info in MTD
Date: Thu, 15 Apr 2010 19:23:00 +0200 [thread overview]
Message-ID: <20100415172300.GF3561@quack.suse.cz> (raw)
In-Reply-To: <g2ycc557aab1004130433g537f417ch401a97e5031f77ff@mail.gmail.com>
On Tue 13-04-10 14:33:01, Kirill A. Shutemov wrote:
> I've got NULL-pointer dereference in __mark_inode_dirty() on chmod()
> for MTD device node. wb->bdi was NULL in this case.
>
> During investigation I've found that MTD subsystem rewrites
> file->f_mapping->backing_dev_info on openning to get mmap() work on
> MMU-less systems. But in fact it rewrites
> inode->i_mapping->backing_dev_info too, since inode->i_mapping ==
> file->f_mapping (see __dentry_open() in fs/open.c). It breaks
> writeback of inode changes.
I think the right trick is to not overwrite
file->f_mapping->backing_dev_info but rather change already
file->f_mapping. For example drivers/char/raw.c does this. Then you'll stop
having problems with writeback code going wild.
> I guess the right way to fix this is changing of __dentry_open() to
> create _copy_ of i_mapping to assign to f_mapping since in common case
> f_mapping != i_mapping. But I'm not sure were the copy should be
> freed.
No, in most cases we will leave f_mapping == i_mapping so copying
i_mapping would be an overkill.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2010-04-15 17:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-13 11:33 [BUG] Rewriting backing_dev_info in MTD Kirill A. Shutemov
2010-04-15 17:23 ` Jan Kara [this message]
2010-04-21 15:21 ` [PATCH] mtd: Do not corrupt backing device for inode Kirill A. Shutemov
2010-04-22 11:08 ` David Woodhouse
2010-04-22 15:20 ` Jan Kara
2010-05-03 16:56 ` [PATCH] mtd: Do not corrupt backing device of device node inode Kirill A. Shutemov
2010-05-03 18:54 ` Jan Kara
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=20100415172300.GF3561@quack.suse.cz \
--to=jack@suse.cz \
--cc=bernd.schmidt@analog.com \
--cc=dhowells@redhat.com \
--cc=dwmw2@infradead.org \
--cc=kirill@shutemov.name \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=viro@zeniv.linux.org.uk \
--cc=virtuoso@slind.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;
as well as URLs for NNTP newsgroup(s).