currentOp should report locks held and locks waiting to be acquired separately. For example, in this excerpt from a currentOp op result, the lock we're waiting for is presumably the Database W (X), but it should say so.
"locks" : { "Global" : "w", "Database" : "W" }, "waitingForLock" : true, "lockStats" : { "Global" : { "acquireCount" : { "r" : NumberLong(1), "w" : NumberLong(1) }, }, "Database" : { "acquireCount" : { "W" : NumberLong(1) }, "acquireWaitCount" : { "W" : NumberLong(1) }, "timeAcquiringMicros" : { "W" : NumberLong(784623211) } }
Additionally, we have access to ResourceId information when reporting the lock information. We should add that information so that we don't have to infer which ops must be trying to get which collection/database locks from the fact that they are deadlocking. There are internal ops that either don't have the "ns" field filled out, or take collection and oplog locks; and there are transactions that now take locks across collections/databases. In conclusion, the ResourceIds would be nice to have.