[sheepdog] [PATCH] add early test for xattr support

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed Jul 18 14:47:01 CEST 2012


At Wed, 18 Jul 2012 12:12:59 +0200,
Dietmar Maurer wrote:
> 
> We want to detect that early and prevent startup. Else the daemon starts
> and simply crash with panic() later.
> 
> Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
> ---
>  sheep/sheep.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/sheep/sheep.c b/sheep/sheep.c
> index b3a12e3..307d013 100644
> --- a/sheep/sheep.c
> +++ b/sheep/sheep.c
> @@ -20,6 +20,7 @@
>  #include <linux/limits.h>
>  #include <sys/syslog.h>
>  #include <sys/types.h>
> +#include <sys/xattr.h>
>  #include <sys/stat.h>
>  #include <fcntl.h>
>  #include <errno.h>
> @@ -258,6 +259,11 @@ int main(int argc, char **argv)
>  	if (ret)
>  		exit(1);
>  
> +	if ((listxattr(dir, NULL, 0) == -1) && (errno == ENOTSUP)) {
> +		fprintf(stderr, "missing xattr support on %s\n", dir);
> +		exit(1);
> +	}
> +

Should we check this in farm_init() since only farm uses extended
attributes?  Currently, there is no other storage driver than farm and
the check will be executed in either way, though.

Thanks,

Kazutaka



More information about the sheepdog mailing list