[PATCH] xfstests 131: kill locktest process in cleanup & better error msgs

Christoph Hellwig hch at infradead.org
Sun Jan 17 05:43:44 CST 2010


On Fri, Jan 15, 2010 at 08:18:55PM -0600, Eric Sandeen wrote:
> I occasionally get failures in 131 like:
> 
> gethostbyname: Success
> 
> 1) perror is the wrong thing for gethostbyname errors, so this
> is confusing

Indeed.

> 2) the locktest thread doesn't get killed, so the fs
> is busy and the next test fails when it can't unmount

Yeah, this was always causing problems for me when running xfstests on
a system without networking for some unknown reason.

> --- a/src/locktest.c
> +++ b/src/locktest.c
> @@ -44,6 +44,8 @@
>  #define PLATFORM_CLEANUP()  /*no-op*/
>  #define LL                  "ll"
>  
> +extern int h_errno;
> +
>  #define inet_aton(STRING, INADDRP) \
>      (((INADDRP)->s_addr = inet_addr(STRING)) == -1 ? 0 : 1)
>  
> @@ -937,7 +939,10 @@ main(int argc, char *argv[])
>          struct hostent  *servInfo;
>  
>          if ((servInfo = gethostbyname(host)) == NULL) {
> -            perror("gethostbyname");
> +	    printf("Couldn't get hostbyname for %s", host);
> +	    if (h_errno == HOST_NOT_FOUND)
> +		printf(": host not found");
> +	    printf("\n");

Might be worth using herror or hsterror, although the manpage marks them
as obsolete..


Anyway, good enough to put in, so:


Reviewed-by: Christoph Hellwig <hch at lst.de>




More information about the xfs mailing list