Skip to content

Commit 657e726

Browse files
mjguzikbrauner
authored andcommitted
tmpfs: use inode_set_cached_link()
Signed-off-by: Mateusz Guzik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent bae8047 commit 657e726

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mm/shmem.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3914,6 +3914,7 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir,
39143914
int len;
39153915
struct inode *inode;
39163916
struct folio *folio;
3917+
char *link;
39173918

39183919
len = strlen(symname) + 1;
39193920
if (len > PAGE_SIZE)
@@ -3935,12 +3936,13 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir,
39353936

39363937
inode->i_size = len-1;
39373938
if (len <= SHORT_SYMLINK_LEN) {
3938-
inode->i_link = kmemdup(symname, len, GFP_KERNEL);
3939-
if (!inode->i_link) {
3939+
link = kmemdup(symname, len, GFP_KERNEL);
3940+
if (!link) {
39403941
error = -ENOMEM;
39413942
goto out_remove_offset;
39423943
}
39433944
inode->i_op = &shmem_short_symlink_operations;
3945+
inode_set_cached_link(inode, link, len - 1);
39443946
} else {
39453947
inode_nohighmem(inode);
39463948
inode->i_mapping->a_ops = &shmem_aops;

0 commit comments

Comments
 (0)