mds: dirty rstat lost during scatter-gather process
In the following scenario, the current lock's dirty state could be lost:
- 1. current lock's state is LOCK_LOCK;
- 2. auth send LOCK_AC_MIX, and the current lock do finish_scatter_update, which wrlock_force the current lock;
- 3. auth send LOCK_AC_LOCK, and would be forced to wait, since the current lock is wrlocked;
- 4. the child inode want to pop rstat up to the current lock's parent, which would also be forced to wait since the current lock state is LOCK_MIX_LOCK; the current lock would be marked dirty, and the child inode would be attached to the corresponding dir's dirty_rstat_inodes;
- 5. the previous finish_scatter_update finishes, the codes reaches here and "start_flush" the current lock, which would clear the dirty flag of the current lock.
As the CInode::encode_lock_state method doesn't pop dirty_rstat_inodes' rstat to the corresponding dir, step 5 actually lead to the lost of the dirty state marked by step 4.