[PATCH] xfsprogs: xfs_copy: use exit() to replace killall()
Christoph Hellwig
hch at infradead.org
Sun May 4 05:34:43 CDT 2014
On Sun, May 04, 2014 at 03:44:15PM +0800, Junxiao Bi wrote:
> Sending a SIGKILL signal to child thread will terminate the whole process,
> xfs_copy will return an error value 137. This cause confuse for script to
> know whether the copy successes.
>
> Calling exit() in main thread can terminate the whole process and return the
> right value.
Looks generally good to me, but the changelog should have some more
details:
> if (buf->length > buf->size) {
> do_warn(_("assert error: buf->length = %d, buf->size = %d\n"),
> buf->length, buf->size);
> - killall();
> - abort();
> + exit(1);
You're replacing the killall with an exit here and removing the abort()
call. I can see arguments for keeping either the abort or exit, but please
document why you did in the patch description. If the exit was
intentional should we return a different value for an assertation
failure?
> - killall();
> - pthread_exit(NULL);
> - /*NOTREACHED*/
> - return 0;
> +
> + exit(0);
You're also replacing the return 0 from main with an exit which
seem superflous.
Btw, I think the reason for this cruft is that xfs_copy was originally
written using the IRIX sproc interface, and the port to pthreads didn't
remove this gem:
http://marc.info/?l=linux-xfs&m=99535721110020&w=2
More information about the xfs
mailing list