This is a note to let you know that I've just added the patch titled xfs: set inode size after creating symlink to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xfs-set-inode-size-after-creating-symlink.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable-owner@xxxxxxxxxxxxxxx Wed Apr 12 06:29:01 2023 From: Chandan Babu R <chandan.babu@xxxxxxxxxx> Date: Wed, 12 Apr 2023 09:56:19 +0530 Subject: xfs: set inode size after creating symlink To: gregkh@xxxxxxxxxxxxxxxxxxx Cc: sashal@xxxxxxxxxx, mcgrof@xxxxxxxxxx, linux-xfs@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx, djwong@xxxxxxxxxx, chandan.babu@xxxxxxxxxx, amir73il@xxxxxxxxx, leah.rumancik@xxxxxxxxx Message-ID: <20230412042624.600511-13-chandan.babu@xxxxxxxxxx> From: Jeffrey Mitchell <jeffrey.mitchell@xxxxxxxxxx> commit 8aa921a95335d0a8c8e2be35a44467e7c91ec3e4 upstream. When XFS creates a new symlink, it writes its size to disk but not to the VFS inode. This causes i_size_read() to return 0 for that symlink until it is re-read from disk, for example when the system is rebooted. I found this inconsistency while protecting directories with eCryptFS. The command "stat path/to/symlink/in/ecryptfs" will report "Size: 0" if the symlink was created after the last reboot on an XFS root. Call i_size_write() in xfs_symlink() Signed-off-by: Jeffrey Mitchell <jeffrey.mitchell@xxxxxxxxxx> Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx> Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Chandan Babu R <chandan.babu@xxxxxxxxxx> Acked-by: Darrick J. Wong <djwong@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/xfs/xfs_symlink.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/xfs/xfs_symlink.c +++ b/fs/xfs/xfs_symlink.c @@ -314,6 +314,7 @@ xfs_symlink( } ASSERT(pathlen == 0); } + i_size_write(VFS_I(ip), ip->i_d.di_size); /* * Create the directory entry for the symlink. Patches currently in stable-queue which might be from stable-owner@xxxxxxxxxxxxxxx are queue-5.4/xfs-merge-the-projid-fields-in-struct-xfs_icdinode.patch queue-5.4/xfs-simplify-a-check-in-xfs_ioctl_setattr_check_cowextsize.patch queue-5.4/xfs-shut-down-the-filesystem-if-we-screw-up-quota-reservation.patch queue-5.4/irqdomain-fix-mapping-creation-race.patch queue-5.4/xfs-add-a-new-xfs_sb_version_has_v3inode-helper.patch queue-5.4/xfs-only-check-the-superblock-version-for-dinode-size-calculation.patch queue-5.4/xfs-force-log-and-push-ail-to-clear-pinned-inodes-when-aborting-mount.patch queue-5.4/xfs-fix-up-non-directory-creation-in-sgid-directories.patch queue-5.4/xfs-consider-shutdown-in-bmapbt-cursor-delete-assert.patch queue-5.4/xfs-set-inode-size-after-creating-symlink.patch queue-5.4/xfs-remove-the-kuid-kgid-conversion-wrappers.patch queue-5.4/xfs-ensure-that-the-inode-uid-gid-match-values-match-the-icdinode-ones.patch queue-5.4/xfs-remove-the-icdinode-di_uid-di_gid-members.patch queue-5.4/xfs-don-t-reuse-busy-extents-on-extent-trim.patch queue-5.4/irqdomain-refactor-__irq_domain_alloc_irqs.patch queue-5.4/xfs-simplify-di_flags2-inheritance-in-xfs_ialloc.patch queue-5.4/irqdomain-look-for-existing-mapping-only-once.patch queue-5.4/xfs-show-the-proper-user-quota-options.patch queue-5.4/xfs-report-corruption-only-as-a-regular-error.patch queue-5.4/xfs-remove-the-di_version-field-from-struct-icdinode.patch