Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4062454iog; Tue, 28 Jun 2022 08:15:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uxkWc3bmF3NQmsFJjvRtg9pcuLaDbsPjnPKgAGliPi6g0EiAZxTLFifMejgtzJsfFL8Ci6 X-Received: by 2002:a17:90b:1b0e:b0:1ec:e2f6:349e with SMTP id nu14-20020a17090b1b0e00b001ece2f6349emr147577pjb.14.1656429326241; Tue, 28 Jun 2022 08:15:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656429326; cv=none; d=google.com; s=arc-20160816; b=0cOijrepyR2qK/Oy7FDcTbpG2GKDW4bKnHOmwow1qnSo1bETRvU7sqSO8h8HCnFHoI RC17XBT5LYZeHa9JfNm81ju9+QgaFI5ZT6o4nUF/BFZNQXv3Cpd8eaQbIsF8PpbE5bbD 9671qkriHc5CTw8AV7dzrKqT6K1EqnL4LzHt9DlvPj1fnvrk3f08JszJvADey5mxgB6u W6tQAqaY65OW1JSF3w/MefL/j9+ChI80f4v3d6EVEEZw5JjarFWGGoX5cjjZASQNTmPy HCqHrA87Ymy2RaX8/AtzDjrr6vJvSB8Zsr2zFVdbnKOTs85nD1eCapzGMS8JFPaeU1kp bNyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :dkim-signature; bh=vcqT4pndB/vuxi0YKM2w//7jCVGvaVOzx+QHC1eNVLo=; b=IUBxGDlI6QvCgiohmPW484RSaY77TroJv7J0nVL/Z2bvecTHeKAFlJwQw7eL8hmxJf p26/CL5hGt4nCCEC/muW41ZyQKitHkVLN1wpJ+wTly9JviDQUNbBrZnSnCGGWVXwSrhc Qrx3hIwEgXrqCkfQlhdzYOm7ZxiZhK684QxB4lph4ndONykElHt9/vHL0dNUqdz/75Mr WRd817MXtJa4It8Uy1R5O3VdTAeJav0dTiA7rE5Wx8kYQkzcaFOdZff5Je3NdT9OeBh1 +kzB00RYb67PUHMDWew9yKvInK1F7orST3nvo/SodKgLFANojqfVnMIDpxnlj6lTsXqY y/fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b="i/aWhnOV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 194-20020a6304cb000000b0040ddd279a66si10282541pge.343.2022.06.28.08.15.04; Tue, 28 Jun 2022 08:15:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b="i/aWhnOV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347261AbiF1O7p (ORCPT + 99 others); Tue, 28 Jun 2022 10:59:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345917AbiF1O7o (ORCPT ); Tue, 28 Jun 2022 10:59:44 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED0E52B267; Tue, 28 Jun 2022 07:59:43 -0700 (PDT) Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 430A22130; Tue, 28 Jun 2022 14:58:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1656428327; bh=vcqT4pndB/vuxi0YKM2w//7jCVGvaVOzx+QHC1eNVLo=; h=Date:To:CC:From:Subject; b=i/aWhnOVQvTsSi5S9tg8QtLi5rXfyRp3Jaft2o/8f4RVErHRd16ejsRfUDD/+m4yF esbd1qCt5f0gF8b1uOveQZZvRww7v/+uEhGxTSdGrqwqYih6lAg44KGCSh2O7ZYJXb CyYLn8GbHfginHTbIZs/FwNrnOpJsz0IsuCqabDU= Received: from [172.30.8.65] (172.30.8.65) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Tue, 28 Jun 2022 17:59:41 +0300 Message-ID: <1645cd93-5dc3-ea35-85ed-eba4e8d2e50e@paragon-software.com> Date: Tue, 28 Jun 2022 17:59:41 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Content-Language: en-US To: CC: , From: Konstantin Komarov Subject: [PATCH] fs/ntfs3: Fix work with fragmented xattr Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [172.30.8.65] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In some cases xattr is too fragmented, so we need to load it before writing. Signed-off-by: Konstantin Komarov --- fs/ntfs3/xattr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index 1e849428bbc8..e581b2bd2b75 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -118,7 +118,7 @@ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea, run_init(&run); - err = attr_load_runs(attr_ea, ni, &run, NULL); + err = attr_load_runs_range(ni, ATTR_EA, NULL, 0, &run, 0, size); if (!err) err = ntfs_read_run_nb(sbi, &run, 0, ea_p, size, NULL); run_close(&run); @@ -444,6 +444,11 @@ static noinline int ntfs_set_ea(struct inode *inode, const char *name, /* Delete xattr, ATTR_EA */ ni_remove_attr_le(ni, attr, mi, le); } else if (attr->non_res) { + err = attr_load_runs_range(ni, ATTR_EA, NULL, 0, &ea_run, 0, + size); + if (err) + goto out; + err = ntfs_sb_write_run(sbi, &ea_run, 0, ea_all, size, 0); if (err) goto out; -- 2.36.1