xattrs: handle both hash forms in reiserfs_check_xattr

It turns out that the csum_partial used on x86_64 is essentially the only
implementation that is 32-bit and it's intended to be folded.  Other
implementations use a 16-bit version.  This library includes the 16-bit
version so that any validation of extended attribute checksums would
fail.  The fix is to convert the 32-bit version to the 16-bit version
if the 16-bit version fails before trying again.

This affects moving file systems between architectures that define
csum_partial differently.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
diff --git a/reiserfscore/xattr.c b/reiserfscore/xattr.c
index 8ad81f3..56c0f60 100644
--- a/reiserfscore/xattr.c
+++ b/reiserfscore/xattr.c
@@ -84,19 +84,19 @@
 	return csum_partial(msg, len, 0);
 }
 
-
 int reiserfs_check_xattr(const void *body, int len)
 {
 	const struct reiserfs_xattr_header *xah = body;
 	int hdrsz = sizeof(struct reiserfs_xattr_header);
-	__u32 hash;
+	__u32 hash, disk_hash;
 
 	if (len < hdrsz)
 		return -EINVAL;
 
 	hash = reiserfs_xattr_hash(body + hdrsz, len - hdrsz);
+	disk_hash = le32_to_cpu(xah->h_hash);
 	return xah->h_magic == cpu_to_le32(REISERFS_XATTR_MAGIC) &&
-	       le32_to_cpu(xah->h_hash) == hash;
+	      (disk_hash == hash || from32to16(disk_hash) == hash);
 }
 
 int reiserfs_acl_count(size_t size)