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

« back to all changes in this revision

Viewing changes to storage/innobase/sync/sync0rw.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 08:30:45 UTC
  • mfrom: (1.4.1)
  • Revision ID: package-import@ubuntu.com-20120222083045-2rd53r4bnyx7qus4
Tags: 5.1.61-0ubuntu0.11.04.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

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************
2
2
The read-write lock (for thread synchronization)
3
3
 
4
 
(c) 1995 Innobase Oy
 
4
Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
5
5
 
6
6
Created 9/11/1995 Heikki Tuuri
7
7
*******************************************************/
476
476
        ulint   i;      /* spin round count */
477
477
 
478
478
        ut_ad(rw_lock_validate(lock));
 
479
#ifdef UNIV_SYNC_DEBUG
 
480
        ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED));
 
481
#endif /* UNIV_SYNC_DEBUG */
479
482
 
480
483
lock_loop:
481
484
        /* Acquire the mutex protecting the rw-lock fields */
663
666
        rw_lock_debug_mutex_exit();
664
667
 
665
668
        if ((pass == 0) && (lock_type != RW_LOCK_WAIT_EX)) {
666
 
                sync_thread_add_level(lock, lock->level);
 
669
                sync_thread_add_level(lock, lock->level,
 
670
                                      lock_type == RW_LOCK_EX
 
671
                                      && lock->writer_count > 1);
667
672
        }
668
673
}
669
674
 
730
735
        ut_ad(lock);
731
736
        ut_ad(rw_lock_validate(lock));
732
737
 
733
 
        mutex_enter(&(lock->mutex));
 
738
        rw_lock_debug_mutex_enter();
734
739
 
735
740
        info = UT_LIST_GET_FIRST(lock->debug_list);
736
741
 
740
745
                    && (info->pass == 0)
741
746
                    && (info->lock_type == lock_type)) {
742
747
 
743
 
                        mutex_exit(&(lock->mutex));
 
748
                        rw_lock_debug_mutex_exit();
744
749
                        /* Found! */
745
750
 
746
751
                        return(TRUE);
748
753
 
749
754
                info = UT_LIST_GET_NEXT(list, info);
750
755
        }
751
 
        mutex_exit(&(lock->mutex));
 
756
        rw_lock_debug_mutex_exit();
752
757
 
753
758
        return(FALSE);
754
759
}
828
833
                                putc('\n', file);
829
834
                        }
830
835
 
 
836
                        rw_lock_debug_mutex_enter();
831
837
                        info = UT_LIST_GET_FIRST(lock->debug_list);
832
838
                        while (info != NULL) {
833
 
                                rw_lock_debug_print(info);
 
839
                                rw_lock_debug_print(file, info);
834
840
                                info = UT_LIST_GET_NEXT(list, info);
835
841
                        }
 
842
                        rw_lock_debug_mutex_exit();
836
843
                }
837
844
 
838
845
                mutex_exit(&(lock->mutex));
868
875
                        putc('\n', stderr);
869
876
                }
870
877
 
 
878
                rw_lock_debug_mutex_enter();
871
879
                info = UT_LIST_GET_FIRST(lock->debug_list);
872
880
                while (info != NULL) {
873
 
                        rw_lock_debug_print(info);
 
881
                        rw_lock_debug_print(stderr, info);
874
882
                        info = UT_LIST_GET_NEXT(list, info);
875
883
                }
 
884
                rw_lock_debug_mutex_exit();
876
885
        }
877
886
}
878
887
 
882
891
void
883
892
rw_lock_debug_print(
884
893
/*================*/
 
894
        FILE*                   f,      /* in: output stream */
885
895
        rw_lock_debug_t*        info)   /* in: debug struct */
886
896
{
887
897
        ulint   rwt;
888
898
 
889
899
        rwt       = info->lock_type;
890
900
 
891
 
        fprintf(stderr, "Locked: thread %lu file %s line %lu  ",
 
901
        fprintf(f, "Locked: thread %lu file %s line %lu  ",
892
902
                (ulong) os_thread_pf(info->thread_id), info->file_name,
893
903
                (ulong) info->line);
894
904
        if (rwt == RW_LOCK_SHARED) {
895
 
                fputs("S-LOCK", stderr);
 
905
                fputs("S-LOCK", f);
896
906
        } else if (rwt == RW_LOCK_EX) {
897
 
                fputs("X-LOCK", stderr);
 
907
                fputs("X-LOCK", f);
898
908
        } else if (rwt == RW_LOCK_WAIT_EX) {
899
 
                fputs("WAIT X-LOCK", stderr);
 
909
                fputs("WAIT X-LOCK", f);
900
910
        } else {
901
911
                ut_error;
902
912
        }
903
913
        if (info->pass != 0) {
904
 
                fprintf(stderr, " pass value %lu", (ulong) info->pass);
 
914
                fprintf(f, " pass value %lu", (ulong) info->pass);
905
915
        }
906
 
        putc('\n', stderr);
 
916
        putc('\n', f);
907
917
}
908
918
 
909
919
/*******************************************************************