[{"id":3642630,"web_url":"http://patchwork.ozlabs.org/comment/3642630/","msgid":"<ardxpk4lmdigmoren3o4gz6stg36vfywdpu5p24t56mlsjrhgo@buwmke3azxba>","list_archive_url":null,"date":"2026-01-28T09:59:53","subject":"Re: [PATCH] ext4: do not check fast symlink during orphan recovery","submitter":{"id":363,"url":"http://patchwork.ozlabs.org/api/people/363/","name":"Jan Kara","email":"jack@suse.cz"},"content":"On Wed 28-01-26 10:16:09, Zhang Yi wrote:\n> From: Zhang Yi <yi.zhang@huawei.com>\n> \n> Commit '5f920d5d6083 (\"ext4: verify fast symlink length\")' causes the\n> generic/475 test to fail during orphan cleanup of zero-length symlinks.\n> \n>   generic/475  84s ... _check_generic_filesystem: filesystem on /dev/vde is inconsistent\n> \n> The fsck reports are provided below:\n> \n>   Deleted inode 9686 has zero dtime.\n>   Deleted inode 158230 has zero dtime.\n>   ...\n>   Inode bitmap differences:  -9686 -158230\n>   Orphan file (inode 12) block 13 is not clean.\n>   Failed to initialize orphan file.\n> \n> In ext4_symlink(), a newly created symlink can be added to the orphan\n> list due to ENOSPC. Its data has not been initialized, and its size is\n> zero. Therefore, we need to disregard the length check of the symbolic\n> link when cleaning up orphan inodes.\n> \n> Fixes: 5f920d5d6083 (\"ext4: verify fast symlink length\")\n> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>\n\nThanks for the patch!\n\n> @@ -6079,18 +6079,22 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,\n>  \t\t\tinode->i_op = &ext4_encrypted_symlink_inode_operations;\n>  \t\t} else if (ext4_inode_is_fast_symlink(inode)) {\n>  \t\t\tinode->i_op = &ext4_fast_symlink_inode_operations;\n> -\t\t\tif (inode->i_size == 0 ||\n> -\t\t\t    inode->i_size >= sizeof(ei->i_data) ||\n> -\t\t\t    strnlen((char *)ei->i_data, inode->i_size + 1) !=\n> -\t\t\t\t\t\t\t\tinode->i_size) {\n> -\t\t\t\text4_error_inode(inode, function, line, 0,\n> -\t\t\t\t\t\"invalid fast symlink length %llu\",\n> -\t\t\t\t\t (unsigned long long)inode->i_size);\n> -\t\t\t\tret = -EFSCORRUPTED;\n> -\t\t\t\tgoto bad_inode;\n> +\n> +\t\t\t/* Orphan cleanup can get a zero-sized symlink. */\n\nI was mulling over this for a while. I'd expand the comment here a bit:\n\n\t\t\t/*\n\t\t\t * Orphan cleanup can see inodes with i_size == 0\n\t\t\t * and i_data uninitialized. Skip size checks in\n\t\t\t * that case. This is safe because the first thing\n\t\t\t * ext4_evict_inode() does for fast symlinks is\n\t\t\t * clearing of i_data and i_size.\n\t\t\t */\n\nand I think we also need to verify that i_nlink is 0 (as otherwise we'd\nleave potentially invalid accessible inode in cache).\n\n\t\t\t\t\t\t\t\tHonza\n\n> +\t\t\tif (!(EXT4_SB(sb)->s_mount_state & EXT4_ORPHAN_FS)) {\n> +\t\t\t\tif (inode->i_size == 0 ||\n> +\t\t\t\t    inode->i_size >= sizeof(ei->i_data) ||\n> +\t\t\t\t    strnlen((char *)ei->i_data, inode->i_size + 1) !=\n> +\t\t\t\t\t\tinode->i_size) {\n> +\t\t\t\t\text4_error_inode(inode, function, line, 0,\n> +\t\t\t\t\t\t\"invalid fast symlink length %llu\",\n> +\t\t\t\t\t\t(unsigned long long)inode->i_size);\n> +\t\t\t\t\tret = -EFSCORRUPTED;\n> +\t\t\t\t\tgoto bad_inode;\n> +\t\t\t\t}\n> +\t\t\t\tinode_set_cached_link(inode, (char *)ei->i_data,\n> +\t\t\t\t\t\t      inode->i_size);\n>  \t\t\t}\n> -\t\t\tinode_set_cached_link(inode, (char *)ei->i_data,\n> -\t\t\t\t\t      inode->i_size);\n>  \t\t} else {\n>  \t\t\tinode->i_op = &ext4_symlink_inode_operations;\n>  \t\t}\n> -- \n> 2.52.0\n>","headers":{"Return-Path":"\n <SRS0=AAf8=AB=vger.kernel.org=linux-ext4+bounces-13379-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ext4@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256\n header.s=susede2_rsa header.b=lm+geycE;\n\tdkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=1BADMmB8;\n\tdkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz\n header.a=rsa-sha256 header.s=susede2_rsa header.b=lm+geycE;\n\tdkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=1BADMmB8;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=150.107.74.76; helo=mail.ozlabs.org;\n envelope-from=srs0=aaf8=ab=vger.kernel.org=linux-ext4+bounces-13379-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c04:e001:36c::12fc:5321\"\n arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=suse.cz","gandalf.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256\n header.s=susede2_rsa header.b=lm+geycE;\n\tdkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=1BADMmB8;\n\tdkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz\n header.a=rsa-sha256 header.s=susede2_rsa header.b=lm+geycE;\n\tdkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=1BADMmB8;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-13379-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz\n header.b=\"lm+geycE\";\n\tdkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz\n header.b=\"1BADMmB8\";\n\tdkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz\n header.b=\"lm+geycE\";\n\tdkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz\n header.b=\"1BADMmB8\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=195.135.223.131","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=suse.cz","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=suse.cz","smtp-out2.suse.de;\n\tdkim=pass header.d=suse.cz header.s=susede2_rsa header.b=lm+geycE;\n\tdkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=1BADMmB8"],"Received":["from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4f1Hs210m9z1xv9\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 28 Jan 2026 21:03:02 +1100 (AEDT)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4f1Hs145tlz4w0L\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 28 Jan 2026 21:03:01 +1100 (AEDT)","by gandalf.ozlabs.org (Postfix)\n\tid 4f1Hs142PBz4wGs; Wed, 28 Jan 2026 21:03:01 +1100 (AEDT)","from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4f1Hrx0nr3z4w0L\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 28 Jan 2026 21:02:57 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 79D9B30431C5\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 28 Jan 2026 09:59:59 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 054D034DB56;\n\tWed, 28 Jan 2026 09:59:58 +0000 (UTC)","from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CCFA34D4F7\n\tfor <linux-ext4@vger.kernel.org>; Wed, 28 Jan 2026 09:59:56 +0000 (UTC)","from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org\n [IPv6:2a07:de40:b281:104:10:150:64:97])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby smtp-out2.suse.de (Postfix) with ESMTPS id 2E7BA5BCDF;\n\tWed, 28 Jan 2026 09:59:54 +0000 (UTC)","from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 14B143EA61;\n\tWed, 28 Jan 2026 09:59:54 +0000 (UTC)","from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n\tby imap1.dmz-prg2.suse.org with ESMTPSA\n\tid Qe8GBRreeWlkdgAAD6G6ig\n\t(envelope-from <jack@suse.cz>); Wed, 28 Jan 2026 09:59:54 +0000","by quack3.suse.cz (Postfix, from userid 1000)\n\tid C66FEA0A1B; Wed, 28 Jan 2026 10:59:53 +0100 (CET)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1769594581; cv=pass;\n\tb=QwtORJkVLbTaDRiUhsPyO+Jro5/bR3cvj5ZClxS6M1q9zNldBLZLaXqARmr43sBzi8ZykWoYVfg5jmL0X8T6uxWAii4CnjkoTQAVMbXBKLU+CC3HAQ1JdvVLXBomY6WY2LfvaaaAjbUJwJFMUMsBpboUYm9uQjbfZEsgyQS0UdREpN74Pc8dCgpNFrM3c5FWgAUw6P0Ax69/wm617XWw6nDOPdMkD7881M9ahMJ8TpXlL4FrrwRRMOsQKwz+h7TmcusSYC5qlZ+SHj22374d1m9Wz5Pi36BO83QUq3QtRPIGoF7iz9ZBt2Uh/hP295VMxj+6FmLpC+vCCSh29awF/A==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1769594397; cv=none;\n b=ZgVGHi8mrqQ1hgACu7DEsXHmQ1W4+ZKHLt+csjF4Q0lwbqxnouFPbA9/1q4gCYvru5QHN2O9GVqBiMp7/Mrxa9Bkl+CU36nPVdju19Awu81LpNo01T64o6Uo1U/mQV/nz+mbBJE+BmSONCMTxtGDyNND4KXhalxrrFFd1P8aa8o="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1769594581; c=relaxed/relaxed;\n\tbh=q5a0VbQCrSFMhLlj8sFch50B6xVZhARSEZpCYRhnc7o=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=HVkBuIWHiKPxURfbF1Nmh54fzeS0oLoFGQiFY0rrlWTLxDxlRjqlgzyj7bz7JUI5+FtWa9eccc7vsvwh1NYCcbZ6FcmNwx2enr3OxUlzThpDaGnlek3NBWI0DhuGABzi2tl0JutkYkxAzfGculTFPPyRffTbGO+CIZZaocKR+O866T/NE+/dOQ0XZR8YYbYv0wxgSWrcpDCGUwTcKufm3YRGb7sOJ+2Sqh8Jg1+2abl0c6F8Ra0999upujhSrq4+10KTumKVM77wIahHZveU5hR+oSiRc3HcfE0Dusz51ynVMaB0oIK6CfkVn9qHX5nEsIcZgshOv2bvgqKwhUirRg==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1769594397; c=relaxed/simple;\n\tbh=xV1vYChwhYRmc/bF7XwFJ8ZSFp7wEcfpN9syg+o06Y8=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=dhIa6CFKg4VjKvvgqIBuitFTmN9osdv/jQuKcmTHioLThsLQLEKHOK8l5XWmoQ4Lq8gUZbQWTgXfoPlOH0P5SA+962CormWOhf9qZNesrV9x4w36pO0d0F0PU1364OmeVaNDfJbyVgXu/VsCewZdf9Ysq3d/Wzo0D6xFVVmufZE="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=suse.cz; dkim=pass (1024-bit key;\n unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256\n header.s=susede2_rsa header.b=lm+geycE;\n dkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=1BADMmB8;\n dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz\n header.a=rsa-sha256 header.s=susede2_rsa header.b=lm+geycE;\n dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=1BADMmB8; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-13379-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=suse.cz;\n spf=pass smtp.mailfrom=suse.cz;\n dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz\n header.b=lm+geycE;\n dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz\n header.b=1BADMmB8;\n dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz\n header.b=lm+geycE;\n dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz\n header.b=1BADMmB8; arc=none smtp.client-ip=195.135.223.131"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_rsa;\n\tt=1769594394;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:content-type:content-type:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=q5a0VbQCrSFMhLlj8sFch50B6xVZhARSEZpCYRhnc7o=;\n\tb=lm+geycEfFRyCrpurGiNtDnVXVr5PcbNpGv0lyEXNXAadPpUvECRWNndQC74XYITNxP8bX\n\t/CoYecElGMr8edw+0pwZ9UUNRSZymLP+DEG46Q/jDLVTRyD5mGu/h+YAZwUe4BXj/omRuD\n\tTZGNCzprEAxX3N7Wd4HxOnwsdh93OLo=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;\n\ts=susede2_ed25519; t=1769594394;\n\th=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:content-type:content-type:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=q5a0VbQCrSFMhLlj8sFch50B6xVZhARSEZpCYRhnc7o=;\n\tb=1BADMmB8KT0Is5gjli39JUNkHUrsxWdsHhBizrfTyZyYevP2i152B3HosO17PKmvrpdi68\n\tzRaGbWE410UBG2CQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_rsa;\n\tt=1769594394;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:content-type:content-type:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=q5a0VbQCrSFMhLlj8sFch50B6xVZhARSEZpCYRhnc7o=;\n\tb=lm+geycEfFRyCrpurGiNtDnVXVr5PcbNpGv0lyEXNXAadPpUvECRWNndQC74XYITNxP8bX\n\t/CoYecElGMr8edw+0pwZ9UUNRSZymLP+DEG46Q/jDLVTRyD5mGu/h+YAZwUe4BXj/omRuD\n\tTZGNCzprEAxX3N7Wd4HxOnwsdh93OLo=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;\n\ts=susede2_ed25519; t=1769594394;\n\th=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n\t mime-version:mime-version:content-type:content-type:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=q5a0VbQCrSFMhLlj8sFch50B6xVZhARSEZpCYRhnc7o=;\n\tb=1BADMmB8KT0Is5gjli39JUNkHUrsxWdsHhBizrfTyZyYevP2i152B3HosO17PKmvrpdi68\n\tzRaGbWE410UBG2CQ=="],"Date":"Wed, 28 Jan 2026 10:59:53 +0100","From":"Jan Kara <jack@suse.cz>","To":"Zhang Yi <yi.zhang@huaweicloud.com>","Cc":"linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca,\n jack@suse.cz,\n\tojaswin@linux.ibm.com, ritesh.list@gmail.com, yi.zhang@huawei.com,\n yizhang089@gmail.com,\n\tlibaokun1@huawei.com, yangerkun@huawei.com, yukuai@fnnas.com","Subject":"Re: [PATCH] ext4: do not check fast symlink during orphan recovery","Message-ID":"<ardxpk4lmdigmoren3o4gz6stg36vfywdpu5p24t56mlsjrhgo@buwmke3azxba>","References":"<20260128021609.4061686-1-yi.zhang@huaweicloud.com>","Precedence":"bulk","X-Mailing-List":"linux-ext4@vger.kernel.org","List-Id":"<linux-ext4.vger.kernel.org>","List-Subscribe":"<mailto:linux-ext4+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ext4+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20260128021609.4061686-1-yi.zhang@huaweicloud.com>","X-Spamd-Result":"default: False [-2.51 / 50.00];\n\tBAYES_HAM(-3.00)[100.00%];\n\tSUSPICIOUS_RECIPS(1.50)[];\n\tNEURAL_HAM_LONG(-1.00)[-1.000];\n\tMID_RHS_NOT_FQDN(0.50)[];\n\tR_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];\n\tNEURAL_HAM_SHORT(-0.20)[-1.000];\n\tMIME_GOOD(-0.10)[text/plain];\n\tMX_GOOD(-0.01)[];\n\tDKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];\n\tRCVD_COUNT_THREE(0.00)[3];\n\tFUZZY_RATELIMITED(0.00)[rspamd.com];\n\tARC_NA(0.00)[];\n\tRBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n\tRCPT_COUNT_TWELVE(0.00)[14];\n\tMIME_TRACE(0.00)[0:+];\n\tRCVD_TLS_LAST(0.00)[];\n\tFREEMAIL_ENVRCPT(0.00)[gmail.com];\n\tTO_DN_SOME(0.00)[];\n\tSPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n\tRECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received];\n\tFROM_EQ_ENVFROM(0.00)[];\n\tFROM_HAS_DN(0.00)[];\n\tTO_MATCH_ENVRCPT_ALL(0.00)[];\n\tTAGGED_RCPT(0.00)[];\n\tMISSING_XM_UA(0.00)[];\n\tRCVD_VIA_SMTP_AUTH(0.00)[];\n\tFREEMAIL_CC(0.00)[vger.kernel.org,mit.edu,dilger.ca,suse.cz,linux.ibm.com,gmail.com,huawei.com,fnnas.com];\n\tDKIM_TRACE(0.00)[suse.cz:+];\n\tDBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,huawei.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.cz:dkim]","X-Spam-Score":"-2.51","X-Rspamd-Queue-Id":"2E7BA5BCDF","X-Rspamd-Action":"no action","X-Rspamd-Server":"rspamd2.dmz-prg2.suse.org","X-Spam-Level":"","X-Spam-Status":"No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_MISSING,\n\tHEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,\n\tSPF_PASS autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"}},{"id":3643132,"web_url":"http://patchwork.ozlabs.org/comment/3643132/","msgid":"<d56ffd21-c835-47cd-8e70-85c0ab320ff8@huaweicloud.com>","list_archive_url":null,"date":"2026-01-29T01:56:48","subject":"Re: [PATCH] ext4: do not check fast symlink during orphan recovery","submitter":{"id":85428,"url":"http://patchwork.ozlabs.org/api/people/85428/","name":"Zhang Yi","email":"yi.zhang@huaweicloud.com"},"content":"On 1/28/2026 5:59 PM, Jan Kara wrote:\n> On Wed 28-01-26 10:16:09, Zhang Yi wrote:\n>> From: Zhang Yi <yi.zhang@huawei.com>\n>>\n>> Commit '5f920d5d6083 (\"ext4: verify fast symlink length\")' causes the\n>> generic/475 test to fail during orphan cleanup of zero-length symlinks.\n>>\n>>   generic/475  84s ... _check_generic_filesystem: filesystem on /dev/vde is inconsistent\n>>\n>> The fsck reports are provided below:\n>>\n>>   Deleted inode 9686 has zero dtime.\n>>   Deleted inode 158230 has zero dtime.\n>>   ...\n>>   Inode bitmap differences:  -9686 -158230\n>>   Orphan file (inode 12) block 13 is not clean.\n>>   Failed to initialize orphan file.\n>>\n>> In ext4_symlink(), a newly created symlink can be added to the orphan\n>> list due to ENOSPC. Its data has not been initialized, and its size is\n>> zero. Therefore, we need to disregard the length check of the symbolic\n>> link when cleaning up orphan inodes.\n>>\n>> Fixes: 5f920d5d6083 (\"ext4: verify fast symlink length\")\n>> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>\n> \n> Thanks for the patch!\n> \n>> @@ -6079,18 +6079,22 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,\n>>  \t\t\tinode->i_op = &ext4_encrypted_symlink_inode_operations;\n>>  \t\t} else if (ext4_inode_is_fast_symlink(inode)) {\n>>  \t\t\tinode->i_op = &ext4_fast_symlink_inode_operations;\n>> -\t\t\tif (inode->i_size == 0 ||\n>> -\t\t\t    inode->i_size >= sizeof(ei->i_data) ||\n>> -\t\t\t    strnlen((char *)ei->i_data, inode->i_size + 1) !=\n>> -\t\t\t\t\t\t\t\tinode->i_size) {\n>> -\t\t\t\text4_error_inode(inode, function, line, 0,\n>> -\t\t\t\t\t\"invalid fast symlink length %llu\",\n>> -\t\t\t\t\t (unsigned long long)inode->i_size);\n>> -\t\t\t\tret = -EFSCORRUPTED;\n>> -\t\t\t\tgoto bad_inode;\n>> +\n>> +\t\t\t/* Orphan cleanup can get a zero-sized symlink. */\n> \n> I was mulling over this for a while. I'd expand the comment here a bit:\n> \n> \t\t\t/*\n> \t\t\t * Orphan cleanup can see inodes with i_size == 0\n> \t\t\t * and i_data uninitialized. Skip size checks in\n> \t\t\t * that case. This is safe because the first thing\n> \t\t\t * ext4_evict_inode() does for fast symlinks is\n> \t\t\t * clearing of i_data and i_size.\n> \t\t\t */\n> \n> and I think we also need to verify that i_nlink is 0 (as otherwise we'd\n> leave potentially invalid accessible inode in cache).\n> \n> \t\t\t\t\t\t\t\tHonza\n\nThank you for the review and suggestions. These makes sense to me, I will\nadd them in my next iteration.\n\nThanks,\nYi.\n\n> \n>> +\t\t\tif (!(EXT4_SB(sb)->s_mount_state & EXT4_ORPHAN_FS)) {\n>> +\t\t\t\tif (inode->i_size == 0 ||\n>> +\t\t\t\t    inode->i_size >= sizeof(ei->i_data) ||\n>> +\t\t\t\t    strnlen((char *)ei->i_data, inode->i_size + 1) !=\n>> +\t\t\t\t\t\tinode->i_size) {\n>> +\t\t\t\t\text4_error_inode(inode, function, line, 0,\n>> +\t\t\t\t\t\t\"invalid fast symlink length %llu\",\n>> +\t\t\t\t\t\t(unsigned long long)inode->i_size);\n>> +\t\t\t\t\tret = -EFSCORRUPTED;\n>> +\t\t\t\t\tgoto bad_inode;\n>> +\t\t\t\t}\n>> +\t\t\t\tinode_set_cached_link(inode, (char *)ei->i_data,\n>> +\t\t\t\t\t\t      inode->i_size);\n>>  \t\t\t}\n>> -\t\t\tinode_set_cached_link(inode, (char *)ei->i_data,\n>> -\t\t\t\t\t      inode->i_size);\n>>  \t\t} else {\n>>  \t\t\tinode->i_op = &ext4_symlink_inode_operations;\n>>  \t\t}\n>> -- \n>> 2.52.0\n>>","headers":{"Return-Path":"\n <SRS0=E7d5=AC=vger.kernel.org=linux-ext4+bounces-13424-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ext4@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=e7d5=ac=vger.kernel.org=linux-ext4+bounces-13424-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.234.253.10 arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-13424-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=45.249.212.56","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com","smtp.subspace.kernel.org;\n spf=none smtp.mailfrom=huaweicloud.com"],"Received":["from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4f1j3b0BFrz1xqf\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 29 Jan 2026 12:58:35 +1100 (AEDT)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4f1j3Z1QFRz4w9k\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 29 Jan 2026 12:58:34 +1100 (AEDT)","by gandalf.ozlabs.org (Postfix)\n\tid 4f1j3Z1GQgz4wB8; Thu, 29 Jan 2026 12:58:34 +1100 (AEDT)","from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4f1j3V1BGbz4w9k\n\tfor <patchwork-incoming@ozlabs.org>; Thu, 29 Jan 2026 12:58:30 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id B7D8F30495EE\n\tfor <patchwork-incoming@ozlabs.org>; Thu, 29 Jan 2026 01:57:08 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 8423E332EBB;\n\tThu, 29 Jan 2026 01:57:00 +0000 (UTC)","from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com\n [45.249.212.56])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 247033203A9;\n\tThu, 29 Jan 2026 01:56:53 +0000 (UTC)","from mail.maildlp.com (unknown [172.19.163.198])\n\tby dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4f1j1L2CLwzKHMPr;\n\tThu, 29 Jan 2026 09:56:38 +0800 (CST)","from mail02.huawei.com (unknown [10.116.40.128])\n\tby mail.maildlp.com (Postfix) with ESMTP id 9D30A40573;\n\tThu, 29 Jan 2026 09:56:51 +0800 (CST)","from [10.174.178.152] (unknown [10.174.178.152])\n\tby APP4 (Coremail) with SMTP id gCh0CgAXd_dgvnppTNTuFQ--.59374S3;\n\tThu, 29 Jan 2026 09:56:51 +0800 (CST)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1769651914; cv=pass;\n\tb=ZMC8Tq3zOBRQ3PL4a0CX/SqfZ+ig364QLEHBklizWrfxeSts5quqYocqJGEMwwl62BHpo3d/UbNCBhM4xPv8gH2nqBeQBMKzzmgUxX37+FcgyJYjSI9XjiemYx+7d7W0YAbg7NmAnYcNIDXg2yGZ08G6xt0v8l+IWy7823749hOUUF448ug9KZjLa0I3n8AfqQOTKlOS+LuMpYpBnfNGdakNt5MDw3i654rR1K4ZQaBf6g6yPp+Co55s/5foDj+jwf9Fvpq9dqfccojuVs+eiqwO2j1TSeyDXpGXJ5fksAfPYqg4dVNRdIGYfabeZ9P1I/EzL0gGdnbQ879G4WsMVQ==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1769651818; cv=none;\n b=dvZ+ow4KY75Vy0yAKPVAFkg/nieVnpBFJm2MmXTtJbjseC9kWU2ApbX1reMLQ9+A8xvSt+yFOw1lgOwUXLbrQVmDIPS78XXjacY6Vh0zhro3h2CRArl+Rotty2vGEMiYCTaDLfxD/XjcWH31J8wlq4Ekp+4ZF0Rat0m0/5Lpp5w="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1769651914; c=relaxed/relaxed;\n\tbh=8+JVj10X6t4hZHLrRB+gDr9Ckp7QdhvHr1SVJeDp6u4=;\n\th=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:\n\t In-Reply-To:Content-Type;\n b=RiWgz965KXnEaqmrENmqvcJVC9Svlg58JkdAF/8cZHIv7XQ6V8jd8TXrOm9NmmmPmbxD7+k5IYkhFJmcynfp3C+VOAkk2kyAGN0MzMMuhh07kyaAdDRB7eGneeCxz2xe+wfu/e4bFQ1FCr1HpUJwTVnO39fMRg9VIjWqh6MM2beahtK489xHPCOQcP8Sm9vAVNUIKgX+elcnlYoNd2nKEXwxFwkaMBTAQHQuh4Q8S+CbzypgfvbKAi4djQrdO43tHFxhVbw15YKkJ1H599KUIlDwE8b6ZuZICCf468guHNmGLqAzhqyE2G7ZhYkJiZQymfGy3sBqTu7L6FHq5ulW1Q==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1769651818; c=relaxed/simple;\n\tbh=JA2gdwNXNSFboqPr70MZOjClN/dk/DvbRQehvr2TPxA=;\n\th=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:\n\t In-Reply-To:Content-Type;\n b=N3tZ1ugSnyQTNvvFqcDaAQj86DJDCfDY/g5a5OpUvnhisDkm4gLAdNVcpT3aRB/tvq7t3zMdgZAn1nLAxMbdMgf9neuiRsABSP+hlsGc7cNwaXOU9NQ7NJpRHxwiJh3L9ymk3Fbi/sUdXJVrGVWUpT/El8wb8ueHL4Dyr+pNUKY="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=pass (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-13424-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=none smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56"],"Message-ID":"<d56ffd21-c835-47cd-8e70-85c0ab320ff8@huaweicloud.com>","Date":"Thu, 29 Jan 2026 09:56:48 +0800","Precedence":"bulk","X-Mailing-List":"linux-ext4@vger.kernel.org","List-Id":"<linux-ext4.vger.kernel.org>","List-Subscribe":"<mailto:linux-ext4+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ext4+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] ext4: do not check fast symlink during orphan recovery","To":"Jan Kara <jack@suse.cz>","Cc":"linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,\n linux-kernel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca,\n ojaswin@linux.ibm.com, ritesh.list@gmail.com, yi.zhang@huawei.com,\n yizhang089@gmail.com, libaokun1@huawei.com, yangerkun@huawei.com,\n yukuai@fnnas.com","References":"<20260128021609.4061686-1-yi.zhang@huaweicloud.com>\n <ardxpk4lmdigmoren3o4gz6stg36vfywdpu5p24t56mlsjrhgo@buwmke3azxba>","Content-Language":"en-US","From":"Zhang Yi <yi.zhang@huaweicloud.com>","In-Reply-To":"<ardxpk4lmdigmoren3o4gz6stg36vfywdpu5p24t56mlsjrhgo@buwmke3azxba>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit","X-CM-TRANSID":"gCh0CgAXd_dgvnppTNTuFQ--.59374S3","X-Coremail-Antispam":"1UD129KBjvJXoWxXry8ZrWDKw47Ar4DurW3ZFb_yoW5Ary7pF\n\tWSk3WkJr4UJF9Ygr4IqrWUXF10g3W0kr4jyrZ5AFWDZ3s8Aa4xKF12gF45WayUtrs8Aa1F\n\tvF1Igr9xZwn8GFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDU0xBIdaVrnRJUUUv0b4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2\n\t6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4\n\tvEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7Cj\n\txVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x\n\t0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG\n\t6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFV\n\tCjc4AY6r1j6r4UM4x0Y48IcVAKI48JM4IIrI8v6xkF7I0E8cxan2IY04v7MxkF7I0En4kS\n\t14v26r1q6r43MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I\n\t8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8\n\tZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x\n\t0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_\n\tJr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU1\n\t7KsUUUUUU==","X-CM-SenderInfo":"d1lo6xhdqjqx5xdzvxpfor3voofrz/","X-Spam-Status":"No, score=-1.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDMARC_MISSING,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,\n\tSPF_HELO_NONE,SPF_PASS autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"}}]