The snapshot mirror sync can hang if all of the following
are true.
1. The snapshot being synced contain only directories and
no files.
2. The crawler finishes syncing dirs and completes crawling
before datasync threads picks it up from syncm queue.
The above scenario can be achieved as below.
1. Configure say /d0 and /d1 for mirroring.
2. Create around 10k files in /d0
3. Create a single dir say /d1/dir0
4. snapshot /d0 and wait for status to change 'syncing'
5. Now, snapshot /d1.
The /d1 snapshot will be stuck in syncing, as datasync
thread's has_pending_work logic would never pick it up
as there are no files to be synced (i.e. dataq is empty
and crawl is finished which is essentially job done) and
never notifies crawler thread to proceed with taking
snapshot.
The fix is to pick up the syncm if the crawler is finished
and dataq is empty to avoid missing notification to the
crawler thread.