HPCC-11734 Revise based on review

1. Not create the 'globalLock' at beginning;
2. Re-check QuerySet after the 'globalLock';
3. return LINK(root);
4. Add similar code for getPackageSetRegistry.

Signed-off-by: wangkx <kevin.wang@lexisnexis.com>