From: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
To: Alexander Kolesen <kolesen.a@gmail.com>
Cc: jfs-discussion@lists.sourceforge.net,
Jens Axboe <jaxboe@fusionio.com>,
rjw@sisk.pl, viro@zeniv.linux.org.uk,
linux-fsdevel@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [Jfs-discussion] Kernel oops when accessing to mounted, but unplugged JFS
Date: Mon, 22 Nov 2010 21:41:13 -0600 [thread overview]
Message-ID: <1290483673.3739.5.camel@shaggy-w500> (raw)
In-Reply-To: <20101122212044.GA2436@localhost>
On Mon, 2010-11-22 at 23:20 +0200, Alexander Kolesen wrote:
> > I haven't dug too far into this yet, but I suspect that
> > aaead25b954879e1a708ff2f3602f494c18d20b5 is related.
> >
> > commit aaead25b954879e1a708ff2f3602f494c18d20b5
> > Author: Christoph Hellwig <hch@lst.de>
> > Date: Mon Oct 4 14:25:33 2010 +0200
> >
> > writeback: always use sb->s_bdi for writeback purposes
> >
> > I'll have to look at what happens when a device is unplugged to see if
> > JFS is missing something, or it's more of a generic problem. I'm open
> > to suggestions from anybody on cc.
> >
> > Thanks,
> > Shaggy
> >
>
> I've tested kernel before and after this commit. Yes, it reproduced after,
> and didn't reproduced before.
I recreated the problem on ext3 as well, so it's not specific to JFS.
I see three potential ways to fix this.
1. bdi_prune_sb() could set sb->s_bdi to &default_backing_dev_info
rather than NULL
2. inode_to_bdi() could return &default_backing_dev_info (or
inode->i_mapping->backing_dev_info) if sb->s_bdi is NULL.
3. the callers of inode_to_bdi() could check for s_bdi being NULL and
exit gracefully.
It seems that Jens and Christoph have ideas about cleaning up the bdi
stuff, so this may be a short-term fix.
Here's a patch for option 2.
---------------------------------
fs: avoid null pointer dereference when a block device is unplugged
Physically unplugging a block device when a file system is mounted can
result in sb->s_bdi being set to NULL. The callers of inode_to_bdi()
expect a non-NULL pointer. Return &default_backing_dev_info instead
of NULL.
Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
---
fs/fs-writeback.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 3d06ccc..5f8cc5d 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -76,7 +76,7 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
if (strcmp(sb->s_type->name, "bdev") == 0)
return inode->i_mapping->backing_dev_info;
- return sb->s_bdi;
+ return sb->s_bdi ? sb->s_bdi : &default_backing_dev_info;
}
static inline struct inode *wb_inode(struct list_head *head)
--
Dave Kleikamp
IBM Linux Technology Center
next prev parent reply other threads:[~2010-11-23 3:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20101121122008.GE4024__36829.3162588545$1290342860$gmane$org@localhost>
2010-11-21 17:57 ` Kernel oops when accessing to mounted, but unplugged JFS Andi Kleen
2010-11-22 16:22 ` [Jfs-discussion] " Dave Kleikamp
2010-11-22 21:20 ` Alexander Kolesen
2010-11-23 3:41 ` Dave Kleikamp [this message]
2010-11-23 8:37 ` Christoph Hellwig
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=1290483673.3739.5.camel@shaggy-w500 \
--to=shaggy@linux.vnet.ibm.com \
--cc=hch@lst.de \
--cc=jaxboe@fusionio.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=kolesen.a@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=viro@zeniv.linux.org.uk \
/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).