[CRIU] [PATCH cr] zdtm: don't worry if a storage device ID is changed on NFS

Stanislav Kinsbursky skinsbursky at parallels.com
Wed Oct 24 09:31:45 EDT 2012


Ack

24.10.2012 17:14, Andrey Vagin пишет:
> Kinsbursky Stas added a comment - 24/Oct/12 4:24 PM
> st_dev won't be the same. It's generated on each NFS superblock creation.
>
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>   test/zdtm/live/static/unlink_fstat03.c |   16 +++++++++++++++-
>   1 files changed, 15 insertions(+), 1 deletions(-)
>
> diff --git a/test/zdtm/live/static/unlink_fstat03.c b/test/zdtm/live/static/unlink_fstat03.c
> index 7ca7eeb..6bf4e18 100644
> --- a/test/zdtm/live/static/unlink_fstat03.c
> +++ b/test/zdtm/live/static/unlink_fstat03.c
> @@ -5,6 +5,8 @@
>   #include <sys/stat.h>
>   #include <unistd.h>
>   #include <string.h>
> +#include <sys/vfs.h>
> +#include <linux/magic.h>
>
>   #include "zdtmtst.h"
>
> @@ -20,6 +22,7 @@ int main(int argc, char ** argv)
>   	size_t fsize=1000;
>   	uint8_t buf[fsize];
>   	struct stat fst, fst2;
> +	struct statfs fsst;
>
>   	test_init(argc, argv);
>
> @@ -59,12 +62,23 @@ int main(int argc, char ** argv)
>   	test_daemon();
>   	test_waitsig();
>
> +	if (statfs(link_name, &fsst) < 0) {
> +		err("statfs(%s): %m\n", link_name);
> +		goto failed;
> +	}
> +
>   	if (fstat(fd, &fst2) < 0) {
>   		err("can't get %s file info after: %m\n", filename);
>   		goto failed;
>   	}
>
> -	if ((fst.st_dev != fst2.st_dev) || (fst.st_ino != fst2.st_ino)) {
> +	/* An NFS mount is restored with another st_dev */
> +	if (fsst.f_type != NFS_SUPER_MAGIC && fst.st_dev != fst2.st_dev) {
> +		fail("files differ after restore\n");
> +		goto failed;
> +	}
> +
> +	if (fst.st_ino != fst2.st_ino) {
>   		fail("files differ after restore\n");
>   		goto failed;
>   	}
>


-- 
Best regards,
Stanislav Kinsbursky



More information about the CRIU mailing list