From nobody Tue Sep 29 13:20:33 2026 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 6E2D847886E for ; Fri, 7 Aug 2026 13:04:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786107902; cv=none; b=OY86wvJ91hZhH9iPFSfwtEEyrBJP1nWll7k7DBUj/vpnhZHTNOxcVUUcKj1/aCZWodCLEqL+Yc8Fd6UB/IxsU4NXafLT5r4wxptC+M+S8jijF6zym4GtPehQeE50WztmwlL1ZZzwstx6fFUvV2HshHtSaZona7fozygdeF/fplQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786107902; c=relaxed/simple; bh=9ezrkqGFPLnUwfeRZPgULDSUOtdgqsHPEtlT17ez4r4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MmEGLjolOsJ3v3uKFKvkvZdozdukxNXi7jn+kTM1CMMfLQrfLKAnI6w3pjRAQttQy2BX0vQn2VEIwKBMM0xekocfhdWKOa5zuc5HJaEzdSsjcx86qbhTVgSDn6jHCU1tdY5oeYTGnl8/7VqWpd2V1+U9H60jDnCNTBqvpBDvtVo= 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=DCmVFlxm; arc=none smtp.client-ip=209.85.210.169 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="DCmVFlxm" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-8484f229529so2856211b3a.2 for ; Fri, 07 Aug 2026 06:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786107892; x=1786712692; 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=nGoCM2e9Adogn0qG20upMZxxQT2t9+y0kQxqYwkOIoc=; b=DCmVFlxmhsCwl8jGKt62Fe3VxpYLgRyxOExlYP2AjYSXQ72R6QLLakN61gcwW3WDQE R3EhtFKXAA2FzAaEefEq//M313Du/5SXmDDWs5b1keiG+MItF0/4ZYxYflxsLHrd8s0/ JGWqUZyiE5zjQMPwbaAVMTKpNLi3cJcbgl7I8xaEI/EoaInkOqSdx2wCksVqJ4ArsWsV bJMIqrSv+bMbxMl+MRTG/qFKvnyUtpRV+Lb9skv6AW1Z86blXRiD0QIbIaQPWvT3uIOe OEEjg1KT0KnHn11hgW8eDeFHlhviX+VHa5rsD13hiYxEMObBgr+ihaKPhcFf4cPemqGq OXNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786107892; x=1786712692; 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=nGoCM2e9Adogn0qG20upMZxxQT2t9+y0kQxqYwkOIoc=; b=WJtLxBx3ZrBq/x8eCwSx6DB9AMBONqa7DcTBJ8Asl2ClhXcC3PRWEPmmIRI5TCGdtM FrDQjWzclfZAkdC4tmkq5i8Y5IPPDnRcbDE56gdvuMfphGUbc4zfEem/YeAaNkpmf+6b kHChYw7ouHwZIm9RywoWsY3Y3bEoxlO9LHn7TNhUiorElKV/BD0PRxM1wQhXYm/Pwpvi 59lWREaeolsdCmKJU8xulFHVb2F4rB8YTgIaksPENT+shLmsXNWLywx/ZlyXDhiN8yGi Jp9sZK3v98armb1WNBRmTf3X0RtUV4+TOwLN1mQ3j/tzSAxqjjBpq5jC8kgguaClFTEO iQJA== X-Forwarded-Encrypted: i=1; AHgh+Rrnh0Nv0zWWqiAIiO9AeyJ37qJhiXy2S7wa4iHcIfhjjSNy5s2dvK6M6mTsNzkt/HmuRDbtH/Pry+dK9Aw=@vger.kernel.org X-Gm-Message-State: AOJu0Yy7VInuKpoFc7sETrfr0Umk4bYaWwiUHygjQuejF18rBAERD8wL 4v69nkH2KC2sxwzPyFXpRHyJlCRiPTwL8rcsri2IuvFmLdZ4G9sAkF4l X-Gm-Gg: AR+sD12BFLGDjrtvhYrh/0VRl+rZikNMBGwHOgn+Kep4OrBYkduuO5EM4NZccLwB9DP 7zHYcMBxWfi8RYh01AvsMUI5fGCvKvH87et7s42LEOFsAQueXRI2DLrD61hrYVLqor3xWyBIkzn tgCJwwTS9VurOFE25jWwIgQF6mfYhZ795a135mTvFPIT9aGuDcC581ZpCcD8tJk0oCoCANX6dXc wkC930pKkX7IahXe8jMoqiVyZxcfCvZucb+9Q61bRfJ17g5G/4BOVl2+LmyquvYoHRIlFgBDZEs +2GCi6ESED1E0sugV24sg8yAANYB27sQi1UAnt8TZmzQ5PTE1T0nDm+aNmNTufyyL2HjN5EYtrN KXNa2FyU7Vpfa+BnXr4oGhsLwGD/L8r6MF8qlY7Qp35vSVv+CR/Vh+rbhsDl2U/GCu5kmZWMB8f 3A3bctLDoGR8yQHhw07mJVveyBYmHo+hsa39oO1jkeXGOpgNugNZkTSQUf7opWHHc5th069r7sO uqkeuqiwhyRU6llCtHeH7Hn X-Received: by 2002:a05:6a00:4fd0:b0:845:2ff5:b66d with SMTP id d2e1a72fcca58-84f2e152632mr25564158b3a.35.1786107892131; Fri, 07 Aug 2026 06:04:52 -0700 (PDT) Received: from qiwenjie-ThinkCentre-M760t.mioffice.cn ([43.224.245.241]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84f5a3a20c2sm1029019b3a.6.2026.08.07.06.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 06:04:51 -0700 (PDT) From: Wenjie Qi X-Google-Original-From: Wenjie Qi To: jaegeuk@kernel.org, chao@kernel.org Cc: willy@infradead.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, stable@kernel.org, qiwenjie@xiaomi.com, qwjhust@gmail.com Subject: [PATCH] f2fs: return symlink writeback errors Date: Fri, 7 Aug 2026 21:04:45 +0800 Message-ID: <20260807130445.465203-1-qiwenjie@xiaomi.com> X-Mailer: git-send-email 2.43.0 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" F2FS writes long symlink data with page_symlink() and then flushes the symlink mapping to reduce the chance of exposing a broken symlink. That flush result is currently ignored. If the writeback fails, symlink() still returns success even though the symlink is not durable and the same operation can already surface -EIO through syncfs(). Return the writeback error to userspace and skip the dirsync flush once the symlink data flush has failed. Fixes: 424fd5d831e1 ("f2fs: Remove f2fs_get_node_page()") Cc: stable@kernel.org Signed-off-by: Wenjie Qi --- Reproducer: - enable FAULT_WRITE_IO on the mounted F2FS filesystem - create a long symlink so the target is written through page_symlink() - old kernel: symlink() returns 0, syncfs() returns -EIO, and the symlink is absent after remount - new kernel: symlink() returns -EIO fs/f2fs/namei.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 7ffdf23cea5e..a8db3928c8b5 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -707,15 +707,16 @@ static int f2fs_symlink(struct mnt_idmap *idmap, stru= ct inode *dir, * performance regression. */ if (!err) { - filemap_write_and_wait_range(inode->i_mapping, 0, - disk_link.len - 1); + err =3D filemap_write_and_wait_range(inode->i_mapping, 0, + disk_link.len - 1); =20 - if (IS_DIRSYNC(dir)) + if (!err && IS_DIRSYNC(dir)) f2fs_sync_fs(sbi->sb, 1); - } else { - f2fs_unlink(dir, dentry); } =20 + if (err) + f2fs_unlink(dir, dentry); + f2fs_balance_fs(sbi, true); goto out_free_encrypted_link; =20 --=20 2.43.0