Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / fs / ocfs2 / aops.c
index f1d1c34..47152bf 100644 (file)
@@ -558,9 +558,16 @@ static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
        u64 vbo_max; /* file offset, max_blocks from iblock */
        u64 p_blkno;
        int contig_blocks;
-       unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
+       unsigned char blocksize_bits;
        unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;
 
+       if (!inode || !bh_result) {
+               mlog(ML_ERROR, "inode or bh_result is null\n");
+               return -EIO;
+       }
+
+       blocksize_bits = inode->i_sb->s_blocksize_bits;
+
        /* This function won't even be called if the request isn't all
         * nicely aligned and of the right size, so there's no need
         * for us to check any of that. */
@@ -659,7 +666,7 @@ out:
        return ret;
 }
 
-const struct address_space_operations ocfs2_aops = {
+struct address_space_operations ocfs2_aops = {
        .readpage       = ocfs2_readpage,
        .writepage      = ocfs2_writepage,
        .prepare_write  = ocfs2_prepare_write,