]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: set inode size after creating symlink
authorJeffrey Mitchell <jeffrey.mitchell@starlab.io>
Wed, 12 Apr 2023 04:26:19 +0000 (09:56 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 10:07:38 +0000 (12:07 +0200)
commit910298c0406ba4d08837c58ce72fc7b0950bd1bd
treeeafca9be996f2d7b62f92a12da842f58fedec1de
parentce133bd97de3bb78668820e4c4292cf4cfc50d4f
xfs: set inode size after creating symlink

commit c787238bbb3d00eec5198b4c2fcef7f6d5149b16 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@starlab.io>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_symlink.c