Received: by 10.213.65.68 with SMTP id h4csp251096imn; Tue, 20 Mar 2018 02:32:52 -0700 (PDT) X-Google-Smtp-Source: AG47ELuWDT6DEAyi9zjFbkENhtgA1ELLUY+vomTiqzwZhV75zbKsqx0ahAt8kqwEBzGVLhbMLblw X-Received: by 10.98.61.206 with SMTP id x75mr7411919pfj.233.1521538372010; Tue, 20 Mar 2018 02:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521538372; cv=none; d=google.com; s=arc-20160816; b=MgW1NI3HlFG0XgcnvbLX8WCEnW4jlL76WUN1Do9wjm6NuEvOjVuK9+1gRzt/rgB0fk 2TKR5FBD/RUPL0Y5hlE8IqPZDlPla9YB/cq+hiharPI3TOCb/JHZZu59DfP3hB4mdmPw y1y/BKAHAeFfHKH6qR4Lb9LjoTLsfyVK35IK5iaMZqqRxWFyqoZ5deBKuB7ejJGg2jmW b/gsBArb+hV4J46/MxZfTCzpHY2JHCPHaRVMMQ6+NhNgDSerc2Rhw0i24YU2ra/38mvP xh9HAn8XEY2ZoWdf+kDxO2MhT6CQJ0Jwrffqte+L48jnu/kT5k0v+ecRm9lgILBLy97p tYFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature :arc-authentication-results; bh=6wUviDbLe5cFYRILVyCVDRS5JEqjz84FvIgfLUCkYfI=; b=BUQHXD5KVpfiIqvevlm7D16SMGwCyDIEg4RUBgosF5kZ3FG+pA70kCr4+pNbTVFYWe wCnRd8JO80WAGf3n6Gkz7sTK+1tHRV2SjluEusLNbOV1v8/6v+zcAMTErNghURJt6FdB fK28Ybns7MlwCWOnpvfu19UvaYeHdX/W68xS4iM0E5WdI/cZV9O50BmrscbIBprNjq2U F9031GLJt6qwVRvUl/CgzTgVc3WBJ/yPZbmiwIlCtl58cyGDxRsFLiLofoWTLoDZW9MS NNBbHm7TOY3GTHPCc4RW+s2Zuxe3fHOI16l/ZMXi+HNMm3OoU/f6I5ldqKxhhZTUMIjQ ZHWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=T5cmsPbg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4si894958pgr.337.2018.03.20.02.32.34; Tue, 20 Mar 2018 02:32:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=T5cmsPbg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752136AbeCTJbX (ORCPT + 99 others); Tue, 20 Mar 2018 05:31:23 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:58226 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbeCTJbS (ORCPT ); Tue, 20 Mar 2018 05:31:18 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2K9Uxm9058172; Tue, 20 Mar 2018 09:31:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=6wUviDbLe5cFYRILVyCVDRS5JEqjz84FvIgfLUCkYfI=; b=T5cmsPbg2g9oZONwb/o4aFxLy8j5wBoTxTsWfwWzts8ikRdtoKqiD9jnjTFtrHJ3RR87 OXbIDWQoB0CYZV4geyeKaNqI6heMaJDoFNnYhZBbCiRITALB5YzvJoSFAO3oipl0rBt+ TQwxwaMrOcGGaP0YkcNJ82uwqJMj5IATUf8Sk8PzMst9WZ9e/nEVtQN//3LrYxmbBR0o 6TudpzoRrU+s1DwdFfletJhqHgQUbn3MaQ0DFLwsNcVXzR6jC168gl4kZUF50NYNh5mr 36cclBZQfky8SB0lgn6WQukVwDoX4vo99gOZqsnZ77R2qMUy9baBb7bfHnncw7LqZHIY Ow== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2gtypv80vx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Mar 2018 09:31:07 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2K9V6AY005458 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Mar 2018 09:31:07 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w2K9V6RU011390; Tue, 20 Mar 2018 09:31:06 GMT Received: from [10.186.49.52] (/10.186.49.52) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Mar 2018 02:31:05 -0700 Subject: Re: [PATCH 4.14 024/110] btrfs: use proper endianness accessors for super_copy To: dsterba@suse.cz, Christoph Biedl , Greg Kroah-Hartman , Liu Bo , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20180307191039.748351103@linuxfoundation.org> <20180307191042.810088712@linuxfoundation.org> <1521139304@msgid.manchmal.in-ulm.de> <20180316123049.GC25079@kroah.com> <1521305582@msgid.manchmal.in-ulm.de> <20180319193221.GP6955@suse.cz> From: Anand Jain Message-ID: Date: Tue, 20 Mar 2018 17:32:56 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180319193221.GP6955@suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8837 signatures=668693 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803200114 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/20/2018 03:32 AM, David Sterba wrote: > On Sat, Mar 17, 2018 at 06:27:15PM +0100, Christoph Biedl wrote: >> Greg Kroah-Hartman wrote... >> >>> On Thu, Mar 15, 2018 at 07:55:42PM +0100, Christoph Biedl wrote: >> >>>>> commit 3c181c12c431fe33b669410d663beb9cceefcd1b upstream. >> >>>> On big-endian systems, this change intruduces severe corruption, >>>> resulting in complete loss of the data on the used block device. >> >>> That sucks. Can you test Linus's tree to verify the problem is there? >>> I'll gladly revert this if Linus's tree also gets the revert, I don't >>> want you to hit this when you upgrade to a newer kernel. >> >> Confirmed: The problem is, err ... was in Linus' tree as well. The >> rather recent commit 8f5fd927c3a7 reverted the change, after that >> everything is as expected again. > > Thanks for checking. > >> Looking at the original commit, I don't have a clue why things go wrong >> so horribly > > It's a half endianness conversion. The plain in-memory structures are in > LE and has to be accessed via the helpers, super block copy and the > root item. The commit adds only one half of the conversion, that > naturally does not exhibit on LE, because the macros are no-op. > > Originally, the items were stored from the on-disk type to on-disk type, > regardless of the CPU: > > super->chunk_root = root_item->bytenr; > > The patch should have added conversion of both values, like > > btrfs_set_super_chunk_root(super, btrfs_root_bytenr(root_item)); > > and not > > btrfs_set_super_chunk_root(super, root_item->bytenr); > > It's not very obvious from the context though, typically there's one > structure that needs the accessors and is set from a value that's in CPU > byteorder. I think that the exception to this pattern confused all > involved developers. > > The root_item members are annotated as __le64 that should be caught by > sparse/smatch checker in the buggy case, but we don't run the checkers > every the time. Ah! the RC is at the other side of the equation. Makes sense to me. Thanks. >> - otherwise don't be afraid of my data. I took this as a >> chance to verify my data recovery procedure, with success. > > Should that not be the case, the damaged items in superblock can be > byteswapped back. That's 6 x u64 at most, I have a tool for that now. > > Thanks again for the report and sorry for the trouble. It's entirely my mistake. My apologies for the inconvenience. Thanks, Anand > -- > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >