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.10-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.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Mon Jun 6 07:00:47 PM CEST 2022 From: Amir Goldstein <amir73il@xxxxxxxxx> Date: Mon, 6 Jun 2022 17:32:48 +0300 Subject: xfs: set inode size after creating symlink To: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Sasha Levin <sashal@xxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, "Darrick J . Wong" <djwong@xxxxxxxxxx>, Christoph Hellwig <hch@xxxxxx>, Brian Foster <bfoster@xxxxxxxxxx>, Christian Brauner <brauner@xxxxxxxxxx>, Luis Chamberlain <mcgrof@xxxxxxxxxx>, Leah Rumancik <leah.rumancik@xxxxxxxxx>, Adam Manzanares <a.manzanares@xxxxxxxxxxx>, linux-xfs@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx, Jeffrey Mitchell <jeffrey.mitchell@xxxxxxxxxx> Message-ID: <20220606143255.685988-2-amir73il@xxxxxxxxx> 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> --- fs/xfs/xfs_symlink.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/xfs/xfs_symlink.c +++ b/fs/xfs/xfs_symlink.c @@ -300,6 +300,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 amir73il@xxxxxxxxx are queue-5.10/xfs-restore-shutdown-check-in-mapped-write-fault-path.patch queue-5.10/xfs-sync-lazy-sb-accounting-on-quiesce-of-read-only-mounts.patch queue-5.10/xfs-fix-incorrect-root-dquot-corruption-error-when-switching-group-project-quota-types.patch queue-5.10/xfs-force-log-and-push-ail-to-clear-pinned-inodes-when-aborting-mount.patch queue-5.10/fsnotify-fix-wrong-lockdep-annotations.patch queue-5.10/inotify-show-inotify-mask-flags-in-proc-fdinfo.patch queue-5.10/xfs-consider-shutdown-in-bmapbt-cursor-delete-assert.patch queue-5.10/xfs-set-inode-size-after-creating-symlink.patch queue-5.10/xfs-fix-chown-leaking-delalloc-quota-blocks-when-fssetxattr-fails.patch queue-5.10/xfs-assert-in-xfs_btree_del_cursor-should-take-into-account-error.patch