~ubuntu-branches/ubuntu/raring/mysql-5.5/raring-proposed

« back to all changes in this revision

Viewing changes to storage/innobase/fil/fil0fil.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-01-16 08:29:25 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20130116082925-znscu5xswxo6pmw2
Tags: 5.5.29-0ubuntu1
* SECURITY UPDATE: Update to 5.5.29 to fix security issues (LP: #1100264)
  - http://www.oracle.com/technetwork/topics/security/cpujan2013-1515902.html
* debian/patches/CVE-2012-5611.patch: removed, included upstream.
* debian/patches/38_scripts__mysqld_safe.sh__signals.patch: refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
                                requests on the file */
188
188
        ibool           stop_new_ops;
189
189
                                /*!< we set this TRUE when we start
190
 
                                deleting a single-table tablespace */
191
 
        ibool           is_being_deleted;
192
 
                                /*!< this is set to TRUE when we start
193
 
                                deleting a single-table tablespace and its
194
 
                                file; when this flag is set no further i/o
195
 
                                or flush requests can be placed on this space,
196
 
                                though there may be such requests still being
197
 
                                processed on this space */
 
190
                                deleting a single-table tablespace.
 
191
                                When this is set following new ops
 
192
                                are not allowed:
 
193
                                * read IO request
 
194
                                * ibuf merge
 
195
                                * file flush
 
196
                                Note that we can still possibly have
 
197
                                new write operations because we don't
 
198
                                check this flag when doing flush
 
199
                                batches. */
198
200
        ulint           purpose;/*!< FIL_TABLESPACE, FIL_LOG, or
199
201
                                FIL_ARCH_LOG */
200
202
        UT_LIST_BASE_NODE_T(fil_node_t) chain;
1286
1288
 
1287
1289
        space->stop_ios = FALSE;
1288
1290
        space->stop_new_ops = FALSE;
1289
 
        space->is_being_deleted = FALSE;
1290
1291
        space->purpose = purpose;
1291
1292
        space->size = 0;
1292
1293
        space->flags = flags;
2301
2302
                return(FALSE);
2302
2303
        }
2303
2304
 
2304
 
        ut_a(space);
 
2305
        ut_a(space->stop_new_ops);
2305
2306
        ut_a(space->n_pending_ops == 0);
2306
2307
 
2307
 
        space->is_being_deleted = TRUE;
2308
 
 
2309
2308
        ut_a(UT_LIST_GET_LEN(space->chain) == 1);
2310
2309
        node = UT_LIST_GET_FIRST(space->chain);
2311
2310
 
2348
2347
        rw_lock_x_lock(&space->latch);
2349
2348
 
2350
2349
#ifndef UNIV_HOTBACKUP
2351
 
        /* Invalidate in the buffer pool all pages belonging to the
2352
 
        tablespace. Since we have set space->is_being_deleted = TRUE, readahead
2353
 
        or ibuf merge can no longer read more pages of this tablespace to the
2354
 
        buffer pool. Thus we can clean the tablespace out of the buffer pool
2355
 
        completely and permanently. The flag is_being_deleted also prevents
2356
 
        fil_flush() from being applied to this tablespace. */
2357
 
 
 
2350
        /* IMPORTANT: Because we have set space::stop_new_ops there
 
2351
        can't be any new ibuf merges, reads or flushes. We are here
 
2352
        because node::n_pending was zero above. However, it is still
 
2353
        possible to have pending read and write requests:
 
2354
 
 
2355
        A read request can happen because the reader thread has
 
2356
        gone through the ::stop_new_ops check in buf_page_init_for_read()
 
2357
        before the flag was set and has not yet incremented ::n_pending
 
2358
        when we checked it above.
 
2359
 
 
2360
        A write request can be issued any time because we don't check
 
2361
        the ::stop_new_ops flag when queueing a block for write.
 
2362
 
 
2363
        We deal with pending write requests in the following function
 
2364
        where we'd minimally evict all dirty pages belonging to this
 
2365
        space from the flush_list. Not that if a block is IO-fixed
 
2366
        we'll wait for IO to complete.
 
2367
 
 
2368
        To deal with potential read requests by checking the
 
2369
        ::stop_new_ops flag in fil_io() */
2358
2370
        buf_LRU_flush_or_remove_pages(
2359
2371
                id, evict_all
2360
2372
                ? BUF_REMOVE_ALL_NO_WRITE
2364
2376
 
2365
2377
        mutex_enter(&fil_system->mutex);
2366
2378
 
 
2379
        /* Double check the sanity of pending ops after reacquiring
 
2380
        the fil_system::mutex. */
 
2381
        if (fil_space_get_by_id(id)) {
 
2382
                ut_a(space->n_pending_ops == 0);
 
2383
                ut_a(UT_LIST_GET_LEN(space->chain) == 1);
 
2384
                node = UT_LIST_GET_FIRST(space->chain);
 
2385
                ut_a(node->n_pending == 0);
 
2386
        }
 
2387
 
2367
2388
        success = fil_space_free(id, TRUE);
2368
2389
 
2369
2390
        mutex_exit(&fil_system->mutex);
2421
2442
 
2422
2443
        ut_a(space != NULL);
2423
2444
 
2424
 
        is_being_deleted = space->is_being_deleted;
 
2445
        is_being_deleted = space->stop_new_ops;
2425
2446
 
2426
2447
        mutex_exit(&fil_system->mutex);
2427
2448
 
3695
3716
 
3696
3717
        space = fil_space_get_by_id(id);
3697
3718
 
3698
 
        if (space == NULL || space->is_being_deleted) {
 
3719
        if (space == NULL || space->stop_new_ops) {
3699
3720
                mutex_exit(&fil_system->mutex);
3700
3721
 
3701
3722
                return(TRUE);
4408
4429
 
4409
4430
        space = fil_space_get_by_id(space_id);
4410
4431
 
4411
 
        if (!space) {
 
4432
        /* If we are deleting a tablespace we don't allow any read
 
4433
        operations on that. However, we do allow write operations. */
 
4434
        if (!space || (type == OS_FILE_READ && space->stop_new_ops)) {
4412
4435
                mutex_exit(&fil_system->mutex);
4413
4436
 
4414
4437
                ut_print_timestamp(stderr);
4624
4647
 
4625
4648
        space = fil_space_get_by_id(space_id);
4626
4649
 
4627
 
        if (!space || space->is_being_deleted) {
 
4650
        if (!space || space->stop_new_ops) {
4628
4651
                mutex_exit(&fil_system->mutex);
4629
4652
 
4630
4653
                return;
4755
4778
             space;
4756
4779
             space = UT_LIST_GET_NEXT(unflushed_spaces, space)) {
4757
4780
 
4758
 
                if (space->purpose == purpose && !space->is_being_deleted) {
 
4781
                if (space->purpose == purpose && !space->stop_new_ops) {
4759
4782
 
4760
4783
                        space_ids[n_space_ids++] = space->id;
4761
4784
                }