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

Liu Yuan namei.unix at gmail.com
Thu Jul 19 08:49:24 CEST 2012


On 07/18/2012 08:47 PM, MORITA Kazutaka wrote:
> 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.
> 

I agree. And I also think that for a gateway-only node, there isn't need
to call farm_init() even case gateway-only node doesn't need backend store.

Thanks,
Yuan




More information about the sheepdog mailing list