src/fiemap-tester: fix getting blocksize on overlayfs
authorAmir Goldstein <amir73il@gmail.com>
Thu, 11 Oct 2018 14:41:06 +0000 (17:41 +0300)
committerEryu Guan <guaneryu@gmail.com>
Sun, 14 Oct 2018 15:53:55 +0000 (23:53 +0800)
commit6fe6c772f66a7c056b5005be4f4b73410b67d89f
treec84cd244c6b68cd4870a9cf1ad2afa6cda752147
parent9200725300a14da54ec0a23554ad5098c1a90675
src/fiemap-tester: fix getting blocksize on overlayfs

There was a regression in v4.19-rc1 that caused FIGETBSZ ioctl
to return 0 on an overlayfs file.

That regression went unnoticed because the xfstests that run
fiemap-tester program terminated in success status after not doing
much instead of failing.

Check for invalid value of block size returned by FIGETBSZ ioctl,
so these tests can detect the regression.

Fallback to statfs(2) for getting the filesystem blocksize if
FIGETBSZ ioctl fails (i.e. on overlayfs).

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
src/fiemap-tester.c