Thank you for your comment. > >> Can you split this patch into two? (Don't set VOL_DIRTY on -ENOTEMPTY and > >> Setting EXFAT_SB_DIRTY is > >> merged into exfat_set_vol_flag). I need to check the second one more. > > > > Can't do that. > > > > exfat_set_vol_flag() is called when rmdir processing begins. When Not-empty > > is detected, > > VOL_DIRTY has already been written and synced to the media. > You can move it before calling exfat_remove_entries(). Can be moved, but that doesn't solve the problem. It causes the similar problem as before. exfat_remove_entries() calls exfat_get_dentry(). If exfat_get_dentry() fails, update bh and set SB_DIRTY will not be executed. As a result, SB_DIRTY is not set and sync does not work. Similar problems occur with other writing functions. Similar problems occur when pre-write checks are added in the future. If you don't set VOL_DIRTY at the beginning, you should delay to set VOL_DIRTY until update-bh & set SB_DIRTY. This avoids unnecessary changes to VOL_DIRTY/VOL_CLEAN. I think this method is smart, but it is difficult to decide when to set VOL_CLEAN. (I tried to implement it, but gave up) > > By doing this, sync is guaranteed if VOL_DIRTY is set by calling > > exfat_set_vol_flag. > > > > This change may still have problems, but it's little better than before, I > > think. > I need to check more if it is the best or there is more better way. I think the sync-problems still exist. Let's improve little by little. :-) BR --- Kohada Tetsuhiro <Kohada.Tetsuhiro@xxxxxxxxxxxxxxxxxxxxxxxxxxx>