~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to storage/innodb_plugin/fsp/fsp0fsp.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mfrom: (1.2.3)
  • Revision ID: package-import@ubuntu.com-20120222141605-5xu64xtalgrxgoie
Tags: 5.1.61-0ubuntu0.10.10.1
* SECURITY UPDATE: Update to 5.1.61 to fix multiple security issues
  (LP: #937869)
  - http://www.oracle.com/technetwork/topics/security/cpujan2012-366304.html
  - CVE-2011-2262
  - CVE-2012-0075
  - CVE-2012-0112
  - CVE-2012-0113
  - CVE-2012-0114
  - CVE-2012-0115
  - CVE-2012-0116
  - CVE-2012-0117
  - CVE-2012-0118
  - CVE-2012-0119
  - CVE-2012-0120
  - CVE-2012-0484
  - CVE-2012-0485
  - CVE-2012-0486
  - CVE-2012-0487
  - CVE-2012-0488
  - CVE-2012-0489
  - CVE-2012-0490
  - CVE-2012-0491
  - CVE-2012-0492
  - CVE-2012-0493
  - CVE-2012-0494
  - CVE-2012-0495
  - CVE-2012-0496
* Dropped patches unnecessary with 5.1.61:
  - debian/patches/61_CVE-2010-3833.dpatch
  - debian/patches/61_CVE-2010-3834.dpatch
  - debian/patches/61_CVE-2010-3835.dpatch
  - debian/patches/61_CVE-2010-3836.dpatch
  - debian/patches/61_CVE-2010-3837.dpatch
  - debian/patches/61_CVE-2010-3838.dpatch
  - debian/patches/61_CVE-2010-3839.dpatch
  - debian/patches/61_CVE-2010-3840.dpatch
  - debian/patches/60_abi-check-include.dpatch
  - debian/patches/62_disable_longfilename_test.dpatch
  - debian/patches/90_fix_testsuite_for_installed_env.dpatch
* debian/mysql-client-5.1.docs: removed EXCEPTIONS-CLIENT file
* debian/mysql-server-5.1.docs,debian/libmysqlclient16.docs,
  debian/libmysqlclient-dev.docs: removed, no longer necessary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
326
326
        ulint           space,  /*!< in: space */
327
327
        ulint           zip_size,/*!< in: compressed page size in bytes
328
328
                                or 0 for uncompressed pages */
329
 
        fseg_inode_t*   seg_inode, /*!< in: segment inode */
 
329
        fseg_inode_t*   seg_inode, /*!< in/out: segment inode */
330
330
        ulint           hint,   /*!< in: hint of which page would be desirable */
331
331
        byte            direction, /*!< in: if the new page is needed because
332
332
                                of an index page split, and records are
333
333
                                inserted there in order, into which
334
334
                                direction they go alphabetically: FSP_DOWN,
335
335
                                FSP_UP, FSP_NO_DIR */
336
 
        mtr_t*          mtr);   /*!< in: mtr handle */
 
336
        mtr_t*          mtr);   /*!< in/out: mini-transaction */
337
337
#endif /* !UNIV_HOTBACKUP */
338
338
 
339
339
/**********************************************************************//**
1548
1548
        ulint   zip_size,/*!< in: compressed page size in bytes
1549
1549
                        or 0 for uncompressed pages */
1550
1550
        ulint   hint,   /*!< in: hint of which page would be desirable */
1551
 
        mtr_t*  mtr)    /*!< in: mtr handle */
 
1551
        mtr_t*  mtr)    /*!< in/out: mini-transaction */
1552
1552
{
1553
1553
        fsp_header_t*   header;
1554
1554
        fil_addr_t      first;
2572
2572
        ulint           space,  /*!< in: space */
2573
2573
        ulint           zip_size,/*!< in: compressed page size in bytes
2574
2574
                                or 0 for uncompressed pages */
2575
 
        fseg_inode_t*   seg_inode, /*!< in: segment inode */
 
2575
        fseg_inode_t*   seg_inode, /*!< in/out: segment inode */
2576
2576
        ulint           hint,   /*!< in: hint of which page would be desirable */
2577
2577
        byte            direction, /*!< in: if the new page is needed because
2578
2578
                                of an index page split, and records are
2579
2579
                                inserted there in order, into which
2580
2580
                                direction they go alphabetically: FSP_DOWN,
2581
2581
                                FSP_UP, FSP_NO_DIR */
2582
 
        mtr_t*          mtr)    /*!< in: mtr handle */
 
2582
        mtr_t*          mtr)    /*!< in/out: mini-transaction */
2583
2583
{
2584
2584
        fsp_header_t*   space_header;
2585
2585
        ulint           space_size;
2803
2803
                fseg_mark_page_used(seg_inode, space, zip_size, ret_page, mtr);
2804
2804
        }
2805
2805
 
2806
 
        buf_reset_check_index_page_at_flush(space, ret_page);
2807
 
 
2808
2806
        return(ret_page);
2809
2807
}
2810
2808
 
2817
2815
ulint
2818
2816
fseg_alloc_free_page_general(
2819
2817
/*=========================*/
2820
 
        fseg_header_t*  seg_header,/*!< in: segment header */
 
2818
        fseg_header_t*  seg_header,/*!< in/out: segment header */
2821
2819
        ulint           hint,   /*!< in: hint of which page would be desirable */
2822
2820
        byte            direction,/*!< in: if the new page is needed because
2823
2821
                                of an index page split, and records are
2829
2827
                                with fsp_reserve_free_extents, then there
2830
2828
                                is no need to do the check for this individual
2831
2829
                                page */
2832
 
        mtr_t*          mtr)    /*!< in: mtr handle */
 
2830
        mtr_t*          mtr)    /*!< in/out: mini-transaction */
2833
2831
{
2834
2832
        fseg_inode_t*   inode;
2835
2833
        ulint           space;
3102
3100
 
3103
3101
        ut_ad(!mutex_own(&kernel_mutex));
3104
3102
 
 
3103
        /* The convoluted mutex acquire is to overcome latching order
 
3104
        issues: The problem is that the fil_mutex is at a lower level
 
3105
        than the tablespace latch and the buffer pool mutex. We have to
 
3106
        first prevent any operations on the file system by acquiring the
 
3107
        dictionary mutex. Then acquire the tablespace latch to obey the
 
3108
        latching order and then release the dictionary mutex. That way we
 
3109
        ensure that the tablespace instance can't be freed while we are
 
3110
        examining its contents (see fil_space_free()).
 
3111
 
 
3112
        However, there is one further complication, we release the fil_mutex
 
3113
        when we need to invalidate the the pages in the buffer pool and we
 
3114
        reacquire the fil_mutex when deleting and freeing the tablespace
 
3115
        instance in fil0fil.c. Here we need to account for that situation
 
3116
        too. */
 
3117
 
 
3118
        mutex_enter(&dict_sys->mutex);
 
3119
 
 
3120
        /* At this stage there is no guarantee that the tablespace even
 
3121
        exists in the cache. */
 
3122
 
 
3123
        if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) {
 
3124
 
 
3125
                mutex_exit(&dict_sys->mutex);
 
3126
 
 
3127
                return(ULLINT_UNDEFINED);
 
3128
        }
 
3129
 
3105
3130
        mtr_start(&mtr);
3106
3131
 
3107
3132
        latch = fil_space_get_latch(space, &flags);
 
3133
 
 
3134
        /* This should ensure that the tablespace instance can't be freed
 
3135
        by another thread. However, the tablespace pages can still be freed
 
3136
        from the buffer pool. We need to check for that again. */
 
3137
 
3108
3138
        zip_size = dict_table_flags_to_zip_size(flags);
3109
3139
 
3110
3140
        mtr_x_lock(latch, &mtr);
3111
3141
 
 
3142
        mutex_exit(&dict_sys->mutex);
 
3143
 
 
3144
        /* At this point it is possible for the tablespace to be deleted and
 
3145
        its pages removed from the buffer pool. We need to check for that
 
3146
        situation. However, the tablespace instance can't be deleted because
 
3147
        our latching above should ensure that. */
 
3148
 
 
3149
        if (fil_tablespace_is_being_deleted(space)) {
 
3150
 
 
3151
                mtr_commit(&mtr);
 
3152
 
 
3153
                return(ULLINT_UNDEFINED);
 
3154
        }
 
3155
 
 
3156
        /* From here on even if the user has dropped the tablespace, the
 
3157
        pages _must_ still exist in the buffer pool and the tablespace
 
3158
        instance _must_ be in the file system hash table. */
 
3159
 
3112
3160
        space_header = fsp_get_space_header(space, zip_size, &mtr);
3113
3161
 
3114
3162
        size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, &mtr);
3276
3324
                        "InnoDB: database!\n", (ulong) page);
3277
3325
crash:
3278
3326
                fputs("InnoDB: Please refer to\n"
3279
 
                      "InnoDB: " REFMAN "forcing-recovery.html\n"
 
3327
                      "InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
3280
3328
                      "InnoDB: about forcing recovery.\n", stderr);
3281
3329
                ut_error;
3282
3330
        }
3394
3442
 
3395
3443
        fseg_free_page_low(seg_inode, space, zip_size, page, mtr);
3396
3444
 
3397
 
#ifdef UNIV_DEBUG_FILE_ACCESSES
 
3445
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
3398
3446
        buf_page_set_file_page_was_freed(space, page);
3399
 
#endif
 
3447
#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
3400
3448
}
3401
3449
 
3402
3450
/**********************************************************************//**
3463
3511
 
3464
3512
        fsp_free_extent(space, zip_size, page, mtr);
3465
3513
 
3466
 
#ifdef UNIV_DEBUG_FILE_ACCESSES
 
3514
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
3467
3515
        for (i = 0; i < FSP_EXTENT_SIZE; i++) {
3468
3516
 
3469
3517
                buf_page_set_file_page_was_freed(space,
3470
3518
                                                 first_page_in_extent + i);
3471
3519
        }
3472
 
#endif
 
3520
#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
3473
3521
}
3474
3522
 
3475
3523
/**********************************************************************//**