On Mon, Nov 27, 2017 at 10:08 AM, cgxu <cgxu@xxxxxxxxxxxx> wrote: > > Hi, > > Recently I found syncfs and umount could not make data consistency in overlayfs. > I did some investigations and now I know synchronization didn’t directly happen > in upperdir filesystem during these operations executed in overlayfs. > Can you share the method of your investigation? Maybe make it into an xfstest? You can probably use dmflakey target. > I'm also confused by below comment in function ovl_sync_fs() in super.c > > /* real inodes have already been synced by sync_filesystem(ovl_sb) */ > > In my understanding sync_filesystem(ovl_sb) can not make real inodes synced > unless delivers real superblock of upperdir filesystem to sync_filesystem(). > > I can’t make sure current implementation is by design or for some other reasons because > sync upperdir filesystem may be a little bit heavy especially in a large filesystem. > Could anyone give me a hint for this? > Looks like you are right. That comment I wrote is an oversight, not by design, although the concern that you raise is valid. > If this problem needs to be fix, I’ll try to make a patch for review. > So the simple way would be to call __sync_filesystem() from ovl_sync_fs() instead of calling upper_sb->s_op->sync_fs(), but that would be heavy as you said. A better fix would be to iterate overlay sb inodes and flush only the dirty ovl_inode_upper() pages, before calling upper_sb->s_op->sync_fs(). I didn't look closely to see how complex that would be, so let me know what you think is best. Thanks, Amir. -- To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html