From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail133.mailersend.net (mail133.mailersend.net [212.11.79.133]) (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 BA7423385A1 for ; Sat, 13 Jun 2026 20:28:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.11.79.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781382537; cv=none; b=qRu+2r4I7uK4D6+8MM3sIp2J6kTXNR9+HOHnComwc/ZmpjPbzwqbLBZzR8yu0QR4K21EHyQacyBCnYkE6RyG9zzI4ZkPsAaEZTmYJ2qxXij7OfyWy7/5i3TNYneaxDz1uLHg1ow3WA+kEpBvaRUnMsXLaExCt6uVINbqEm1T8KA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781382537; c=relaxed/simple; bh=GbZferK7dvytbg95Iq5Q1luNdF6CaQLlH8863DtI5Ks=; h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n7D4OFWu+/NLBPmwYwrF0iJTWG00eTSAGW+s8oqdfTfRHb2heJiodh0W80e2AOEZH58Ns6By6puDUi3vwqt24oYXFdJoQgnBMSsrhnFyRo9q/PGnSx8RCiaJ1ND/OFnu73iZQKIFt85LnjFyzciISiQvDOQM+hfTRwsMKp9MUck= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=hatchling.org; spf=pass smtp.mailfrom=mta.hatchling.org; dkim=pass (1024-bit key) header.d=hatchling.org header.i=@hatchling.org header.b=JnNHGrcu; dkim=pass (1024-bit key) header.d=mailersend.net header.i=@mailersend.net header.b=YL9L+L24; arc=none smtp.client-ip=212.11.79.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=hatchling.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mta.hatchling.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hatchling.org header.i=@hatchling.org header.b="JnNHGrcu"; dkim=pass (1024-bit key) header.d=mailersend.net header.i=@mailersend.net header.b="YL9L+L24" DKIM-Signature: a=rsa-sha256; bh=N3tmiE2uJVeZ0ITnjg6+ghHDHw85rvLVlCqarCy+Mxw=; c=relaxed/relaxed; d=hatchling.org; h=DKIM-Signature:X-Mailer-Info:Subject:From:To:Cc:Date:Received:Message-ID:X-MailerSend-RecipientID:Feedback-ID:X-MailerSend-MessageID:In-Reply-To:References:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; s=mlsend2; t=1781381774; v=1; b=JnNHGrcu1Txm3yUVfmoOTiBjeACDZfs48AUwVWTklTrI+l4gTnM140urcwCftfsljNP0K5xr AECMyuiHoPf4njxyrli2ndeQnzae6GBWOxxEUklQu32/JRRgw+byp/rTVXmH4eyJQQQzOAq9Tqq DIApIE2PYFYvD/SfZH05k8Hc= DKIM-Signature: a=rsa-sha256; bh=N3tmiE2uJVeZ0ITnjg6+ghHDHw85rvLVlCqarCy+Mxw=; c=relaxed/relaxed; d=mailersend.net; h=X-Mailer-Info:Subject:From:To:Cc:Date:Received:Message-ID:X-MailerSend-RecipientID:Feedback-ID:X-MailerSend-MessageID:In-Reply-To:References:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; s=mlsend; t=1781381774; v=1; b=YL9L+L2481kwKTRelKDVJAgLYI8f8/OgEwCFs1v9j3RpJdqCPA9Ib4qMFnYuzGxr4TXvbbbB U3jBLUET8d6YAuCr9v5CbvUx+OTLbL0qiMAOtHr4PdktKHDGAKnBG45jwh4m63vssHVozdYRAKw FkZHtKeKUA5VNRQZsioBol5w= X-Mailer-Info: 10.AZlZWY1xGd.AZlZWY1xGd0MTN5UzN.Abp5Wd41yalJnblxGQ2dWZy5yalJn blxmLvJ3Z.gNhJDOmFWM0ATZ2kjMhRzN0M2M5UTY1kzK0MTN5UzN.... Subject: [PATCH v2 2/2] fs/ntfs3: fix lseek EINVAL on sparse/compressed files with 64-bit clusters From: Senjin To: ntfs3@lists.linux.dev Cc: almaz.alexandrovich@paragon-software.com, linux-kernel@vger.kernel.org, Senjin Date: 13 Jun 2026 20:16:14 -0000 Received: from 10.32.1.122 by 10.132.0.99 with http; 13 Jun 2026 20:16:14 +0000 Message-ID: <6a2dba8ee876a55491e53f7a@mailersend.net> X-MailerSend-RecipientID: 6a2dba8ee876a55491e53f7a;6a28fa140e692a474c395a59;r9084zv9678gw63d Feedback-ID: r9084zv9678gw63d:MailerSend X-MailerSend-MessageID: 6a2dba8e16561d003133c5de In-Reply-To: <20260613201610.14467-1-senjin@hatchling.org> References: <20260613201610.14467-1-senjin@hatchling.org> Reply-To: senjin@hatchling.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable When CONFIG_NTFS3_64BIT_CLUSTER is enabled, sbi->maxbytes_sparse is set to -1. As a signed loff_t this is -1LL, the most negative value. Any lseek on a sparse or compressed file passes this as maxsize to vfs_setpos(), which returns -EINVAL whenever offset > maxsize, and since -1LL is less than any non-negative offset, every seek fails, including lseek(fd, 0, SEEK_SET). The intent of -1 here appears to be "no limit" (matching the spirit of MAX_LFS_FILESIZE assigned to sbi->maxbytes and sb->s_maxbytes in the same block), but the signed type makes it the minimum instead of the maximum. Fix by assigning MAX_LFS_FILESIZE to sbi->maxbytes_sparse in the 64-bit cluster path, consistent with the other two limits set there. Observed on a 16 TB NTFS volume with 0xFFFFFEFF total clusters compiled with CONFIG_NTFS3_64BIT_CLUSTER=3Dy. Sequential reads via dd/cp worked correctly; any lseek call on sparse files returned EINVAL, preventing archive managers and other tools from random-accessing files on the volume. The non-64-bit-cluster path correctly sets maxbytes_sparse to (1ull << (cluster_bits + 32)) - 1, a large positive value. Signed-off-by: Senjin --- fs/ntfs3/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index XXXXXXX..XXXXXXX 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -1193,7 +1193,7 @@ static int ntfs_fill_super(struct super_block *sb,= struct fs_context *fc) #ifdef CONFIG_NTFS3_64BIT_CLUSTER if (clusters >=3D (1ull << (64 - cluster_bits))) sbi->maxbytes =3D -1; - sbi->maxbytes_sparse =3D -1; + sbi->maxbytes_sparse =3D MAX_LFS_FILESIZE; sb->s_maxbytes =3D MAX_LFS_FILESIZE; #else /* Maximum size for sparse file. */ -- 2.x