summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Mitchell <jeffrey.mitchell@starlab.io>2021-01-22 16:48:20 -0800
committerDarrick J. Wong <djwong@kernel.org>2021-01-22 16:54:50 -0800
commit8aa921a95335d0a8c8e2be35a44467e7c91ec3e4 (patch)
treeba98059c538a42071ac15afb692284287002f83c
parent8321ddb2fa2964bffbc61400894a47dc3462323f (diff)
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: 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>
-rw-r--r--fs/xfs/xfs_symlink.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c
index 0b8136a32484..7f96649e918a 100644
--- a/fs/xfs/xfs_symlink.c
+++ b/fs/xfs/xfs_symlink.c
@@ -305,6 +305,7 @@ xfs_symlink(
}
ASSERT(pathlen == 0);
}
+ i_size_write(VFS_I(ip), ip->i_d.di_size);
/*
* Create the directory entry for the symlink.