1 - Description When mount overlayfs over xfs. Delete file will remain stub.(Works fine on ext4) 2 - What Expect Overlayfs should works well on xfs. 3 - How to reproduce ``` # dd if=/dev/zero of=./xfs.img bs=1M count=30 # mkfs.xfs ./xfs.img ; # mkdir -p /xfs-test/ # mount -o loop xfs.img /xfs-test/ # cd /xfs-test; mkdir lower work upper mp; # mkdir lower/a;touch lower/a/b # mount -t overlay overlay -o lowerdir=./lower,upperdir=./upper,workdir=./work ./mp # rm -rf a/b # cd a # ls -lah [root@localhost a]# ls -lah ls: cannot access b: No such file or directory total 0 drwxr-xr-x 1 root root 14 Dec 3 17:57 . drwxr-xr-x 1 root root 14 Dec 3 17:56 .. ?????????? ? ? ? ? ? b # ls b ls: cannot access b: No such file or directory # cd ..;rm -rf a rm: cannot remove ‘a’: Directory not empty ``` 4- Frequency of reproduction Always
Created attachment 196361 [details] quick dirty fix A quick look of source code points out function ovl_dir_read in /linux-4.3/fs/overlayfs/readdir.c L259: if (!err && rdd->first_maybe_whiteout) { rdd->first_maybe_whiteout will remains zero in xfs. but works fine in ext4. remove it works for me. still digging why it not work.
attachment 196361 [details] won't work. don't use it. ==== i use xfs v2 dirs. [root@localhost xfs]# file /home/x /home/x: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs) when track code to xfs. dir_emit always return filetype as 0. when examine xfs_dir2_sf_getdents / xfs_dir2_block_getdents / xfs_dir2_leaf_getdents. I found dp->d_ops->data_get_ftype / dp->d_ops->sf_get_ftype will always points to xfs_dir2_sfe_get_ftype / xfs_dir2_data_get_ftype. which return XFS_DIR3_FT_UNKNOWN forever. change to xfs_dir3_sfe_get_ftype / xfs_dir3_data_get_ftype should fix this fine. I'll submit a patch soon but not expect xfs accept it.(changed libxfs)
Created attachment 196531 [details] do not use dir2 ftypes even in v2 dir.
thanks dave. to solve this: mkfs.xfs -n ftype=1 still need process dents return d_type == DT_UNKNOWN.