From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (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 5B26834BA28 for ; Mon, 13 Jul 2026 17:51:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783965084; cv=none; b=MpBQCp9Y5KhoObYFDVxwJ11bxlAMIkxWB48XhRUehO96bm3b5YnT8kbSB28eq6lPH14dYeRDWUxPBMT+RwDTItltvPFTsrNtDKsMmLnloiZ6AeBWJYFIVBfcaPnRx/i1C6ZgCqvlKOJIuKnGj6MsTV55QFET5abEGrOgNFTrdR8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783965084; c=relaxed/simple; bh=lIuSLdLFUMYHYIkQND+5ezv/2Gm5SAaNrjxK7kuHO+s=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=cZGWpOYtOJU+Rr7qQ6xVqJPAHz/215hx7Q9u8w05CztTjPQzNN3nGhGuU1GgKX85VAQr0w+V7ilxBN3j/PSDgvhRVeiOKrpulhkeCZ2EjKMf60s9zosS5Wd2bhoSIlam1gRlQXJTLbvQ+RbuQlYHY/ThE/3KSJ+eZZ6phV/2p3Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MMqsSX/i; arc=none smtp.client-ip=209.85.216.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MMqsSX/i" Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-38dd55ad76cso120043a91.1 for ; Mon, 13 Jul 2026 10:51:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783965083; x=1784569883; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=7b5s+xdKt531buNfoF0W/b2tSHU/H/fnzI1QXPkyZpQ=; b=MMqsSX/in9g+9lC5p+hPbfv1yt+3IABHCtE63KQwhVXtHcOovTpB6BcbDAmLsuu1Y+ bm+Tnsm3/OouiRaMv2YH5CMgcktwZOmFCMfM7Zvxy/KY4tCEdvAZT+QVHVhXvJ+gP62P GIV8UZ4YdM1D1lJJOdlDZys1LU0sulcMKWxfcTyinoPIxncvBHfS3Cs2o9CcsUTOKKa0 1AMxcw/S8TdI/nIQ+8yQV8Cwj3E4XXsDgBSZozlb9h6RQhS2ZLJJ5D2ZjD6zwjvhLWZC qVTSzp+k5lKVKobCIggQIztGIzWWPFlNfeQ+iPlA8gRRT4OzhOCdxYspLTwa31vL6Cmg C0aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783965083; x=1784569883; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=7b5s+xdKt531buNfoF0W/b2tSHU/H/fnzI1QXPkyZpQ=; b=ImUtYz83hJMvQwobvP+kYXhgI4pOvK47tIg1hlBvF9AS9IN5wT7/RqwqUMcnIjbsPY 6/mQWhzrMiDvIOILIZEPWwWsHRKMSYWpy4Amlb7sd3pS8hsMSz/mZIF679vAnUGc9mP4 5cq2zau2TGmAXXH9m8F/cpRB9D7Y8f9iMnRxGByBOv8O1Kp+/PEAxrHvxx4yMwfakhyv x51asQtroSuDhE802l3oNAUnpUTi9hUeVVz6R1T253R6I6t2w9s5BYH6oRcoPfVTUt6s ujMOQeOxSfkaSy+1JS6kjyO145KZ8Ufs7oPnxa1oVjsJVNxYSY41ND4S6pdc7OeMz+Cx ce6Q== X-Forwarded-Encrypted: i=1; AHgh+RpgRgycNG246tmBokEPyihXP48eiQxDRBGgLjESFk2scl7qkNN/vYlAcSVGKhRYm/OIAQMatd9Wn882BG8=@vger.kernel.org X-Gm-Message-State: AOJu0YwHaqt/DiruW2D0HHKTjS0aFrqx9rAeM1/hUXYGEwbk4y4Zl1b1 Qs6Vp8p4T4u8SvrSEODw6Qomb5QXLSLFUO2giZ7qXld2e/TAnK2PsPkP X-Gm-Gg: AfdE7ckEkVmzdp8W0fiaZWfihmVsWIY3tzNknmthTzd6ZUsf+RUZk8e4gCYqT9iaExE 9nj1F9OU2ZZJNEnltjbt6Rvo7+Diaq8fajOsMbLaSLRSvP+vjHQ21TagHW4tmflYGqTJFSc1gqT 0Vtbz+wQiuzR+YjvurqZxqk1UXbi400YxPcN17ozMVE0auripHHtx3iLtBaUZXuYQXh0zCtcSJe xqjyv2B9q8LTKa30N7jv2C8XtfzpV08yP8bBEErY6iixziGqEM0vNKUm68uD3Z+jO9a06pMt1SG aN5K5tToawgNQsyXDLatwP01dsIjP87ibbWbDNKveKklG6cYBH62+x6PODeZh9iBMk+IJiozFyl s1J0sVtMOMVSeXJyWM4j9yocMi38PEwAakQJqbMcIfFqe63EH+nK/3tTuZeUUzUTcOK5ti/DyBg IF9KxAwVb9MecyR8PRQ3/JNM/NkE2Uf+jEtlRBkxM= X-Received: by 2002:a17:90b:2548:b0:36b:4d63:4a93 with SMTP id 98e67ed59e1d1-38d15364030mr14878803a91.13.1783965082598; Mon, 13 Jul 2026 10:51:22 -0700 (PDT) Received: from primary ([223.181.22.8]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f596asm72354027eec.2.2026.07.13.10.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 10:51:22 -0700 (PDT) From: Vidhu Sarwal To: almaz.alexandrovich@paragon-software.com Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linux.dev, Vidhu Sarwal , syzbot+57f9327d593d301ce2a2@syzkaller.appspotmail.com Subject: [RFC PATCH] fs/ntfs3: prevent positive E_NTFS_NONRESIDENT from reaching writeback error handling Date: Mon, 13 Jul 2026 14:11:40 +0530 Message-ID: <20260713084140.249515-1-vidhu.linux@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit attr_data_write_resident() returns the internal positive status code E_NTFS_NONRESIDENT when the DATA attribute becomes non-resident. ntfs_writepages() propagates this value into generic writeback error handling, which expects a standard negative errno and triggers WARN_ON_ONCE(err > 0). Translate positive E_NTFS_* status codes to -EIO before recording the writeback error. This prevents positive internal status codes from reaching generic writeback code while preserving the existing behaviour of treating this path as a writeback error. Reported-by: syzbot+57f9327d593d301ce2a2@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=57f9327d593d301ce2a2 Signed-off-by: Vidhu Sarwal --- RFC: I'd appreciate guidance on whether -EIO is the appropriate errno here. E_NTFS_NONRESIDENT indicates that the DATA attribute became non-resident during writeback. Translating it to -EIO prevents the positive internal status code from reaching generic writeback code and preserves the existing behaviour of treating this path as a writeback error. However, if the intended behaviour is to retry the write using the non-resident path instead of failing it, then the correct solution would be more than a simple errno translation. The proposed change assumes the current terminal-error behaviour is intentional. fs/ntfs3/inode.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 0c9bd669117d..9458867c6b0b 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1019,6 +1019,15 @@ static int ntfs_writepages(struct address_space *mapping, folio_unlock(folio); if (err2) { + /* + * attr_data_write_resident() can return the + * positive internal code E_NTFS_NONRESIDENT; + * both mapping_set_error() and writeback_iter() + * need a negative errno and warn on a positive + * value. + */ + if (err2 > 0) + err2 = -EIO; mapping_set_error(mapping, err2); if (!err) err = err2; base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa -- 2.53.0