ceph: move dereference after NULL test

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Alexander Beregalov 2010-02-22 17:17:44 +03:00 committed by Sage Weil
parent 5b3a4db3e4
commit 4ce1e9adab

View File

@ -144,7 +144,7 @@ static int ceph_set_page_dirty(struct page *page)
*/ */
static void ceph_invalidatepage(struct page *page, unsigned long offset) static void ceph_invalidatepage(struct page *page, unsigned long offset)
{ {
struct inode *inode = page->mapping->host; struct inode *inode;
struct ceph_inode_info *ci; struct ceph_inode_info *ci;
struct ceph_snap_context *snapc = (void *)page->private; struct ceph_snap_context *snapc = (void *)page->private;
@ -153,6 +153,8 @@ static void ceph_invalidatepage(struct page *page, unsigned long offset)
BUG_ON(!PagePrivate(page)); BUG_ON(!PagePrivate(page));
BUG_ON(!page->mapping); BUG_ON(!page->mapping);
inode = page->mapping->host;
/* /*
* We can get non-dirty pages here due to races between * We can get non-dirty pages here due to races between
* set_page_dirty and truncate_complete_page; just spit out a * set_page_dirty and truncate_complete_page; just spit out a