diff options
author | 2024-11-20 12:20:36 +0100 | |
---|---|---|
committer | 2024-12-22 11:29:51 +0100 | |
commit | 657e726e0cb9ba4f583ae7d226100bc43cc43a41 (patch) | |
tree | af32d4014c1fea1d3f26d0421bbb89041ab6f675 | |
parent | ext4: use inode_set_cached_link() (diff) | |
download | wireguard-linux-657e726e0cb9ba4f583ae7d226100bc43cc43a41.tar.xz wireguard-linux-657e726e0cb9ba4f583ae7d226100bc43cc43a41.zip |
tmpfs: use inode_set_cached_link()
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://lore.kernel.org/r/20241120112037.822078-4-mjguzik@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | mm/shmem.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index ccb9629a0f70..7beba4c1be5a 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3914,6 +3914,7 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir, int len; struct inode *inode; struct folio *folio; + char *link; len = strlen(symname) + 1; if (len > PAGE_SIZE) @@ -3935,12 +3936,13 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir, inode->i_size = len-1; if (len <= SHORT_SYMLINK_LEN) { - inode->i_link = kmemdup(symname, len, GFP_KERNEL); - if (!inode->i_link) { + link = kmemdup(symname, len, GFP_KERNEL); + if (!link) { error = -ENOMEM; goto out_remove_offset; } inode->i_op = &shmem_short_symlink_operations; + inode_set_cached_link(inode, link, len - 1); } else { inode_nohighmem(inode); inode->i_mapping->a_ops = &shmem_aops; |