Patch #1 adds missing mutex locking around se/sh/instance writes. Patches #2/3 perform various cleanups.