From nobody Thu Dec 18 08:37:56 2025 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E6F01C69D for ; Wed, 10 Dec 2025 01:57:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765331858; cv=none; b=Ux/DeeC7bMz5lr8t4ye2ouWpLOrvNkpPfGDm0425YqqS5S5gCCCXFMzJz+joYD8rKWBH2+B4LrseZB9oyQv1/s1sV5QaFY931f/bZhXkhXi8mf44j6MokG43W0eFPaGFVZ/fZbK8i/cPmP7IeBYf+C/Ghfh4jpiPXWH+tbbl6lE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765331858; c=relaxed/simple; bh=rIjBSk8W9vHLkEVzp7rPU63DurUszuJ0brbQFnUC4kE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hs4Wjs5YGZcraCdyblu8xUFNP9jjS5ckEe7dY3Wuv64eYXcH/yyuDz049LMmyAdzGZQWJM5t98HR3RG9hfHOs7QH6H6P6N8tf2thybn1DdkM35yghgU6uHXiS65ZWsSO3SM+mroSNTJTxNhHdFgg83prnw+1AkdMvIZSXOWQ9To= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=S7gKm7uc; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="S7gKm7uc" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4779f9696e7so5059865e9.2 for ; Tue, 09 Dec 2025 17:57:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1765331854; x=1765936654; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vqN1NKbSsmoO7F1QrFMDpSGOC06IfLpd/c1+vjKbvBI=; b=S7gKm7ucvvhswWMhgykpf23OOhDzjdfMbW3xWfC82czq0dOiA5mBYr6OmPVM7eAE70 i4bDRzAu2H+UOMxgZjgCs/6385M0/H+Eo9GFPxdRA3PwooJrem2m88KJUJmfae0wgBz/ EO5XrnKq01yhB+uKDBWJVSVt8T+7x3M0XOn8E5Upy2wApN5TpBaK5FrizewBkDKT0nZe f5BiSbb9G4Powi6dOKNwREyrS9UN7/rvllD7UvmvApSy1BCy7CM5ZR/4yuTdS3x3m6zc pDujXESr5Qo/n03PYR5tySsclH2qXNrFRkU9cGKJyn1CZ9E9IVnzPQOwSsVgthebE1Kh RQhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765331854; x=1765936654; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vqN1NKbSsmoO7F1QrFMDpSGOC06IfLpd/c1+vjKbvBI=; b=RLvmB+b8Bm48la3aRl6h3UU1C4Pk5W1ZX0HD/HBS4A1P5uX5pDawSgPTTetQ/Q9Y61 qjeDvQ6nZIp71P6j49ZuJJdad4o7/AQtx5AYr+DAdpKOvlVM2UsW4KItmMYn49ex3v5b JI/4iV3hOaB8Vkbkzr07Po5I4xCpXQIZNxdubjUjHZW2/0MQ4f1ZxfRITOWTdhlN7jdg Eumr0WQNPVTiWSz6eYdC+jHDe1fSHKyzkNZ0F5HrK3kXPzj13LEmr4ojPZqiwjzSVtbL G7l83QFz6gjpLDMYm7P2OquMo55X+gl80MUQffl0a6DrKqC2ognG7G96OjuRdu3qR9ME 0ELg== X-Forwarded-Encrypted: i=1; AJvYcCXivHs90uZF83qP3Z77P32HXEHyAAhUMe93NClmXEw7Nl3jTJG/8aVsWnOu1nckXaZ0NPjxi3RCezzVlqE=@vger.kernel.org X-Gm-Message-State: AOJu0YwAM25H/bV7qIPMMiJbRZOV+tU6jecUWyKR5KJ4ERPPt2kyis8B Y7WTdmMcGNSFX6uj4lKDYE6lhZCzlsq/1nSuybMjgLVGXDbcDUSoHCmaW/yXdDgc/0I= X-Gm-Gg: ASbGncv4zVDbj3HVUfieo6dWB3mStvVZsF3mZ2/SjFzUurcDe939SC+VH+wZm4R5fiF FacDV10T9cozXCHNBaii5agi4hazMcSN1niYBc9zEeOaIwzK8PWO5bsf+9unKSrny0wjL36PmQC eSV6FxagwsU/fJjZKHceC8RuJXY9INozaUNxyD1FC1fZwAZlt4SL1pVX4TxTi1n2JEfLQzRW+Rt UTsq7ctTLomqWqz4AXS0MdkqXG6Bde6zzHXnxcZ6OFlZhuyuXvByXIfjim50ii7HU5jSjjJo/he Dpkw8UWrTAm1THv2OUFucUwMKoV/4RAwLWSzeYtdGy1UTGMG8cmjYsT1zIXJWVSSLKQfA54cj45 m+EsKRk6FpcC5Nf3GaDS5x4IEDNyzlpuk+zeHzPaZcOm+rvKzdKA1TxHObtQpKzpBXLrq4Vn08I S/oqZdspIwAIL9Gtz9YOh4CXnF X-Google-Smtp-Source: AGHT+IEVfsY1W3wTrb83B3sGRGtfJ0RinkE70SwJcnOVRx5VTrUkcJQHazTErgFY0aEpk2xNg8265A== X-Received: by 2002:a05:600c:45d5:b0:477:7b16:5f97 with SMTP id 5b1f17b1804b1-47a8360681dmr4671435e9.0.1765331853748; Tue, 09 Dec 2025 17:57:33 -0800 (PST) Received: from localhost.localdomain ([202.127.77.110]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29dae49ca1esm164755985ad.2.2025.12.09.17.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 17:57:33 -0800 (PST) From: Heming Zhao To: joseph.qi@linux.alibaba.com, mark@fasheh.com, jlbec@evilplan.org Cc: Heming Zhao , ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 1/1] ocfs2: fix reflink preserve cleanup issue Date: Wed, 10 Dec 2025 09:57:24 +0800 Message-ID: <20251210015725.8409-2-heming.zhao@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251210015725.8409-1-heming.zhao@suse.com> References: <20251210015725.8409-1-heming.zhao@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" commit c06c303832ec ("ocfs2: fix xattr array entry __counted_by error") doesn't handle all cases and the cleanup job for preserved xattr entries still has bug: - the 'last' pointer should be shifted by one unit after cleanup an array entry. - current code logic doesn't cleanup the first entry when xh_count is 1. Note, commit c06c303832ec is also a bug fix for 0fe9b66c65f3. Fixes: 0fe9b66c65f3 ("ocfs2: Add preserve to reflink.") Signed-off-by: Heming Zhao --- fs/ocfs2/xattr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index dc1761e84814..31d023f9e2ed 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -6364,6 +6364,10 @@ static int ocfs2_reflink_xattr_header(handle_t *hand= le, (void *)last - (void *)xe); memset(last, 0, sizeof(struct ocfs2_xattr_entry)); + last =3D &new_xh->xh_entries[le16_to_cpu(new_xh->xh_count)] - 1; + } else { + memset(xe, 0, sizeof(struct ocfs2_xattr_entry)); + last =3D NULL; } =20 /* --=20 2.43.0