ceph: move dereference after NULL test
authorAlexander Beregalov <a.beregalov@gmail.com>
Mon, 22 Feb 2010 14:17:44 +0000 (17:17 +0300)
committerSage Weil <sage@newdream.net>
Tue, 23 Feb 2010 22:26:34 +0000 (14:26 -0800)
Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/addr.c

index 25360d517d1be0f8e4927372f96712ae8561ae4f..23bb0ceabe31904521019fafd36bd1cf9ba8f8c1 100644 (file)
@@ -144,7 +144,7 @@ static int ceph_set_page_dirty(struct page *page)
  */
 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_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(!page->mapping);
 
+       inode = page->mapping->host;
+
        /*
         * We can get non-dirty pages here due to races between
         * set_page_dirty and truncate_complete_page; just spit out a