Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-30932

dbCheck command violates lock ordering by acquiring lock on "local" database first

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Storage
    • None
    • Execution Team 2021-12-13
    • 0

      The AutoGetDbForDbCheck RAII class first attempts to acquire a lock on the "local" database in MODE_IX and then attempts to acquire a lock on the database to check in MODE_S. This is incompatible with the lock ordering that other database operations use when calling repl::logOp() because other threads will first attempt to acquire a lock on the database and then attempt to acquire a lock on the "local" database.

      AutoGetDbForDbCheck::AutoGetDbForDbCheck(OperationContext* opCtx, const NamespaceString& nss)
          : localLock(opCtx, "local"_sd, MODE_IX), agd(opCtx, nss.db(), MODE_S) {}
      

            Assignee:
            josef.ahmad@mongodb.com Josef Ahmad
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: