提交 8aa921a9 编写于 作者: J Jeffrey Mitchell 提交者: Darrick J. Wong

xfs: set inode size after creating symlink

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: NJeffrey Mitchell <jeffrey.mitchell@starlab.io>
Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NBrian Foster <bfoster@redhat.com>
上级 8321ddb2
...@@ -305,6 +305,7 @@ xfs_symlink( ...@@ -305,6 +305,7 @@ xfs_symlink(
} }
ASSERT(pathlen == 0); ASSERT(pathlen == 0);
} }
i_size_write(VFS_I(ip), ip->i_d.di_size);
/* /*
* Create the directory entry for the symlink. * Create the directory entry for the symlink.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册