Re: [PATCH] ext2: return -ENODATA for NULL i_file_acl in ext2_xattr_list

From: shenghui
Date: Tue Jul 13 2010 - 19:47:44 EST


2010/7/14 Andreas Dilger <adilger@xxxxxxxxx>:
> The "error" value gets overwritten almost immediately with -EIO, and then at the end of the function if there is an xattr block but it doesn't contain any attributes (I'm not sure if this could happen, but it seems possible) it will return "error = buffer_size - rest; Â/* total size */", so 0 if "rest" was not changed from its initial value of buffer_size.
>
> The question is why this return value should be changed to -ENODATA in the first place? ÂThis isn't true for ext3_xattr_list() or ext4_xattr_list(). ÂI tend to think it is not an error to get back an empty list, and applications shouldn't treat it as such. ÂMost applications will check "if (rc < 0)" and treat it as an error. ÂThis is different than e.g. requesting a specific value by name (which does return -ENODATA) because it would otherwise be ambiguous whether the xattr existed but had zero size or didn't exist at all.
>

Thanks for your explanation!

--


Thanks and Best Regards,
shenghui
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/