From patchwork Sat May 20 01:56:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: piaojun X-Patchwork-Id: 9738437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D146600C8 for ; Sat, 20 May 2017 01:58:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 195FD2838B for ; Sat, 20 May 2017 01:58:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B01E285B8; Sat, 20 May 2017 01:58:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2A9572838B for ; Sat, 20 May 2017 01:58:06 +0000 (UTC) Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v4K1vJem024957 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 20 May 2017 01:57:20 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v4K1vFDc001249 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 20 May 2017 01:57:16 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1dBtdr-0008Lr-G0; Fri, 19 May 2017 18:57:15 -0700 Received: from userv0022.oracle.com ([156.151.31.74]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1dBtdZ-0008KI-AD for ocfs2-devel@oss.oracle.com; Fri, 19 May 2017 18:56:57 -0700 Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v4K1uuxS000602 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Sat, 20 May 2017 01:56:57 GMT Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.20/8.16.0.20) with SMTP id v4K1rCwB020643 for ; Sat, 20 May 2017 01:56:56 GMT Authentication-Results: oracle.com; spf=pass smtp.mailfrom=piaojun@huawei.com Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by userp2030.oracle.com with ESMTP id 2aj7h5dp11-1 (version=TLSv1 cipher=RC4-SHA bits=128 verify=NOT) for ; Sat, 20 May 2017 01:56:56 +0000 Received: from 172.30.72.53 (EHLO DGGEML401-HUB.china.huawei.com) ([172.30.72.53]) by dggrg02-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id ANX13132; Sat, 20 May 2017 09:56:52 +0800 (CST) Received: from [10.177.253.249] (10.177.253.249) by smtpscn.huawei.com (10.3.17.32) with Microsoft SMTP Server id 14.3.301.0; Sat, 20 May 2017 09:56:42 +0800 To: Joseph Qi From: piaojun Message-ID: <591FA232.3000502@huawei.com> Date: Sat, 20 May 2017 09:56:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 X-Originating-IP: [10.177.253.249] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.591FA264.0090, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 5ecd903bc8ad67da3daec27552ff34bb X-PDR: PASS X-ServerName: szxga02-in.huawei.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 ip4:119.145.14.64/30 ip4:58.251.152.64/30 ip4:119.145.14.93 ip4:58.251.152.93 ip4:194.213.3.17 ip4:206.16.17.72 ip4:119.145.14.199 ip4:58.251.152.179 ip4:119.145.14.52 ip4:58.251.152.52 ip4:45.249.212.187/29 ip4:45.249.212.191 ~all X-Proofpoint-Virus-Version: vendor=nai engine=5800 definitions=8534 signatures=668456 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=8 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705200009 Cc: "ocfs2-devel@oss.oracle.com" Subject: [Ocfs2-devel] [PATCH] o2image: back-up xattr tree for regular file X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: userv0022.oracle.com [156.151.31.74] X-Virus-Scanned: ClamAV using ClamSMTP when traversing regular file's inode with xattr btree in traverse_inode(), we will get into traverse_chains() rather than traverse_xb(). so xattr tree is not back-up actually. Signed-off-by: Jun Piao --- o2image/o2image.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/o2image/o2image.c b/o2image/o2image.c index ee62acf..c56bbcf 100644 --- a/o2image/o2image.c +++ b/o2image/o2image.c @@ -256,9 +256,16 @@ static errcode_t traverse_inode(ocfs2_filesys *ofs, uint64_t inode) * * NOTE: we do need to handle its xattr btree if exists. */ - if (!S_ISDIR(di->i_mode) && !(di->i_flags & OCFS2_SYSTEM_FL) && - !(di->i_dyn_features & OCFS2_HAS_XATTR_FL)) + if (!S_ISDIR(di->i_mode) && !(di->i_flags & OCFS2_SYSTEM_FL)) { + if ((di->i_dyn_features & OCFS2_HAS_XATTR_FL) && di->i_xattr_loc) { + /* traverse xattr btree to map bucket leaves */ + ret = traverse_xb(ofs, di->i_xattr_loc); + if (ret) + com_err(program_name, ret, "while traversing xattr tree" + " %"PRIu64"", inode); + } goto out; + } /* Read and traverse group descriptors */ if (di->i_flags & OCFS2_SYSTEM_FL) @@ -291,9 +298,6 @@ static errcode_t traverse_inode(ocfs2_filesys *ofs, uint64_t inode) ret = traverse_chains(ofs, &(di->id2.i_chain), dump_type); else if (di->i_flags & OCFS2_DEALLOC_FL) ret = mark_dealloc_bits(ofs, &(di->id2.i_dealloc)); - else if ((di->i_dyn_features & OCFS2_HAS_XATTR_FL) && di->i_xattr_loc) - /* Do need to traverse xattr btree to map bucket leaves */ - ret = traverse_xb(ofs, di->i_xattr_loc); else { /* * Don't check superblock flag for the dir indexing @@ -318,11 +322,9 @@ static errcode_t traverse_inode(ocfs2_filesys *ofs, uint64_t inode) } out_error: - if (ret) { + if (ret) com_err(program_name, ret, "while scanning inode %"PRIu64"", inode); - goto out; - } out: if (buf) ocfs2_free(&buf);