From: Jan Kara <jack@suse.cz>
To: David Woodhouse <dwmw2@infradead.org>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>,
Jan Kara <jack@suse.cz>, Alexander Viro <viro@zeniv.linux.org.uk>,
David Howells <dhowells@redhat.com>,
Alexander Shishkin <virtuoso@slind.org>,
linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: Do not corrupt backing device for inode
Date: Thu, 22 Apr 2010 17:20:23 +0200 [thread overview]
Message-ID: <20100422152023.GD5805@quack.suse.cz> (raw)
In-Reply-To: <1271934535.11751.1550.camel@macbook.infradead.org>
On Thu 22-04-10 12:08:55, David Woodhouse wrote:
> On Wed, 2010-04-21 at 18:21 +0300, Kirill A. Shutemov wrote:
> > + /*
> > + * We cannot modify file->f_mapping->backing_dev_info directly,
> > + * because it will corrupt backing device for inode, since
> > + * inode->i_mapping is equal to file->f_mapping. So we have to
> > + * copy f_mapping first.
> > + */
> > + file->f_mapping = kmalloc(sizeof(*file->f_mapping), GFP_KERNEL);
> > + memcpy(file->f_mapping, inode->i_mapping,
> > + sizeof(*file->f_mapping));
> > file->f_mapping->backing_dev_info = mtd->backing_dev_info;
> > + }
>
> Ick. What about the rest of file->f_mapping? That'll still be inherited.
>
> Jan pointed at drivers/char/raw.c as an example, but that doesn't do
> anything as ugly as this -- that sets file->f_mapping to point at
> bdev->bd_inode->i_mapping instead.
>
> I suspect we should do something similar -- have an inode for the MTD
> device, with a valid i_data of its own.
Yes, that's what I meant by my suggestion... Sorry if I wasn't clear
enough.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2010-04-22 15:20 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
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 [this message]
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=20100422152023.GD5805@quack.suse.cz \
--to=jack@suse.cz \
--cc=dhowells@redhat.com \
--cc=dwmw2@infradead.org \
--cc=kirill@shutemov.name \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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).