From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 221113F105D; Wed, 9 Sep 2026 14:30:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964234; cv=none; b=cae5G1AqlZyep28SzRF4o/FAHo4nkW9tVoMPRjlJkW0/OOU/ZKRIrU8OEj3aD7jXb1w2RNt/GMJet3Hhdn1vM4BWn7vQ5WUx25/vc1dN6u0IBIHkdp5iHRlUrOiKEqpzqxSZXDJdEhoeVD1PyLu6yYHm90hyi6LexRRQljOJxCY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964234; c=relaxed/simple; bh=IoIyok3vlD5VF+6xcUkGUH71z04wniml2xMMT5t1piQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dUWNpLSD2To5dTqbLLmiVKBnQpAUBg0W9hlJVA4A/Nz9FNZGranaKGHG//ah96FzbX/Wl08DC3P+ZI453Qe57+J4YD8YoKy+P+XZFuLQ6fNkanL5r8ZDEiq0Lc9WBIhAduN7PhUewFLPiLYEIhUVdoZ0d8YZsFWbqEdVqVolr3Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TzFerINl; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TzFerINl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C99E1F00A3A; Wed, 9 Sep 2026 14:30:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788964232; bh=rWUVJTbaAWFLh3Q37kg1bh2Ok5NqHBYIwkroMC+vGO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TzFerINlis6ZEru44ghxVCspvzDZUs+kNyYul2vbKhnR3XvolX+ST2KvJNc41iRpB vPjm77dGzEVni95Z7TfXO5EMlY/aOddWaNNJcpVdyVCeJQ6ch0BW5luLsspD2Yug5s mkonAaj3KA93J63xqA4hr7cbWBRsL7TA/leX6y7Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Wenjie Qi , Chao Yu , Jaegeuk Kim Subject: [PATCH 6.18 351/583] f2fs: return symlink writeback errors Date: Wed, 9 Sep 2026 15:40:36 +0200 Message-ID: <20260909134250.156273339@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909134237.773280130@linuxfoundation.org> References: <20260909134237.773280130@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wenjie Qi commit a2c73a7a677afdaa8b16d775188f9ef5cfbfd8b2 upstream. 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: d0cae97cb600 ("f2fs: flush symlink path to avoid broken symlink after POR") Cc: stable@kernel.org Signed-off-by: Wenjie Qi Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/namei.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -681,15 +681,16 @@ err_out: * performance regression. */ if (!err) { - filemap_write_and_wait_range(inode->i_mapping, 0, - disk_link.len - 1); + err = filemap_write_and_wait_range(inode->i_mapping, 0, + disk_link.len - 1); - if (IS_DIRSYNC(dir)) + if (!err && IS_DIRSYNC(dir)) f2fs_sync_fs(sbi->sb, 1); - } else { - f2fs_unlink(dir, dentry); } + if (err) + f2fs_unlink(dir, dentry); + f2fs_balance_fs(sbi, true); goto out_free_encrypted_link;