From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4836C0044D for ; Mon, 16 Mar 2020 22:56:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AF17D205ED for ; Mon, 16 Mar 2020 22:56:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732854AbgCPW4w (ORCPT ); Mon, 16 Mar 2020 18:56:52 -0400 Received: from mx2.suse.de ([195.135.220.15]:49748 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732840AbgCPW4w (ORCPT ); Mon, 16 Mar 2020 18:56:52 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 33738ADB3; Mon, 16 Mar 2020 22:56:51 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 7DB12DA726; Mon, 16 Mar 2020 23:56:23 +0100 (CET) Date: Mon, 16 Mar 2020 23:56:23 +0100 From: David Sterba To: Nikolay Borisov Cc: linux-btrfs@vger.kernel.org, Johannes.Thumshirn@wdc.com Subject: Re: [PATCH] btrfs-progs: Fix xxhash on big endian machines Message-ID: <20200316225623.GU12659@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Nikolay Borisov , linux-btrfs@vger.kernel.org, Johannes.Thumshirn@wdc.com References: <20200316090512.21519-1-nborisov@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200316090512.21519-1-nborisov@suse.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Mon, Mar 16, 2020 at 11:05:12AM +0200, Nikolay Borisov wrote: > xxhash's state and results are always in little, but in progs after the > hash was calculated it was copied to the final buffer via memcpy, > meaning it'd be parsed as a big endian number on big endian machines. > This is incompatible with the kernel implementation of xxhash which > results in erroneous "checksum didn't match" errors on mount. > > Fix it by using put_unaligned_le64 which always ensures the resulting > checksum will be copied in little endian format as the kernel expects > it. > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=206835 > Fixes: f070ece2e98f ("btrfs-progs: add xxhash64 to mkfs") > Signed-off-by: Nikolay Borisov Added to devel, thanks.