[Galaxy S II Q&A, Help & Troubleshooting] DavisNT:
Wanted to share my experience.

Symptoms:

Phone gets warm under camera

Battery drains fast (about 1-2% every minute)

Phone doesn't go into Deep Sleep

Process android.process.media uses about 20-25% CPU

Other third party applications may hog CPU; after killing/removing them android.process.media stays biggest CPU hog

Wiping data of Media Storage (under Settings -> Applications) may not help

Wiping all data (except sdcards), reflashing ROM etc. may not help

While media scanner is hogging CPU something like the following may be repeatedly logged in logcat

D/dalvikvm( 2237): GC_EXPLICIT freed 117K, 31% free 5599K/8008K, paused 2ms+3ms, total 39ms
D/dalvikvm( 2600): GC_CONCURRENT freed 342K, 54% free 3523K/7588K, paused 3ms+2ms, total 27ms
D/dalvikvm( 2237): GC_EXPLICIT freed 121K, 31% free 5600K/8008K, paused 2ms+3ms, total 44ms
D/dalvikvm( 2600): GC_CONCURRENT freed 347K, 53% free 3573K/7588K, paused 1ms+3ms, total 23ms
D/dalvikvm( 2237): GC_EXPLICIT freed 120K, 31% free 5598K/8008K, paused 2ms+2ms, total 38ms
D/dalvikvm( 2600): GC_CONCURRENT freed 337K, 53% free 3625K/7588K, paused 2ms+3ms, total 26ms
D/dalvikvm( 2600): GC_CONCURRENT freed 359K, 52% free 3666K/7588K, paused 3ms+5ms, total 58ms
D/dalvikvm( 2237): GC_EXPLICIT freed 117K, 31% free 5598K/8008K, paused 5ms+11ms, total 95ms
D/dalvikvm( 2600): GC_CONCURRENT freed 296K, 51% free 3762K/7588K, paused 3ms+2ms, total 33ms

Root cause:

A few ClockworkMod (CWM) recovery DUP backups (in my case 5)

Solution:

Delete ClockworkMod recovery DUP backups by connecting phone to PC in Mass Storage mode and deleting /clockworkmod/blobs from both sdcards (warning: you may want to backup /clockworkmod to PC before deleting these backups from phone)

DUP is default format for older versions of ClockworkMod recovery 6. DUP backup consists of all backed up files being copied to sdcard (without any form of archiving (except division into several hundred/thousand folders)), (theoretically) this format allows backing up only deltas. From the first moments I saw this format I knew it will have huge drawbacks (because it stresses filesystem, inappropriate for that kind of loads).

In versions of CWM recovery shipped with latest CM 10.1 nightlies default backup format is changed back to TAR (a few tar archives are written to sdcard). It may be possible to change backup format in backup and restore -> choose default backup format menu of CWM recovery.

Looks like when sdcard contains enough files (in my case about 12 000 from only 5 backups) Media Scanner (or may be Android system itself) runs into problems.

In my case first time I noticed the problem suddenly - last week my phone got warm and drained battery within 25 minutes. I charged phone, wiped data of Media Storage, it didn't help. Afterwards I connected phone to computer, checked both sdcards for errors (chkdsk reported that there were no filesystem errors), wiped data of Media Storage again and then problem mysteriously "disappeared" for a few days.

Yesterday I updated to latest CM 10.1 nightly, wiped cache and Dalvik Cache and on first boot the problem re-appeared. Reverting to previous ROM (older CM 10.1 nightly) didn't help. Backing up and wiping data also didn't help. Removing external sdcard also didn't help (because CWM DUP backups were on internal sdcard). Finally I thought that virtually the only remaining thing that can cause problems is CWM DUP backups, connected phone to PC (in Mass Storage mode) and deleted folder /clockworkmod/blobs from internal sdcard (warning: this will invalidate all DUP backups), again rebooted into recovery, wiped /cache and /data and problem was solved. Afterwards I restored from latest backup (which I made while already having this problem), just in case wiped data of Media Storage (under Settings -> Applications) once more and rebooted (the problem was solved).

CyanogenMod bug is here https://jira.cyanogenmod.org/browse/CYAN-745

Please vote for it, if you find this important!