Skip to content

Commit f7e4328

Browse files
Martin Brandenburggregkh
authored andcommitted
orangefs: set i_size on new symlink
commit f6a4b4c upstream. As long as a symlink inode remains in-core, the destination (and therefore size) will not be re-fetched from the server, as it cannot change. The original implementation of the attribute cache assumed that setting the expiry time in the past was sufficient to cause a re-fetch of all attributes on the next getattr. That does not work in this case. The bug manifested itself as follows. When the command sequence touch foo; ln -s foo bar; ls -l bar is run, the output was lrwxrwxrwx. 1 fedora fedora 4906 Apr 24 19:10 bar -> foo However, after a re-mount, ls -l bar produces lrwxrwxrwx. 1 fedora fedora 3 Apr 24 19:10 bar -> foo After this commit, even before a re-mount, the output is lrwxrwxrwx. 1 fedora fedora 3 Apr 24 19:10 bar -> foo Reported-by: Becky Ligon <[email protected]> Signed-off-by: Martin Brandenburg <[email protected]> Fixes: 71680c1 ("orangefs: Cache getattr results.") Cc: [email protected] Cc: [email protected] Signed-off-by: Mike Marshall <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b8511db commit f7e4328

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/orangefs/namei.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ static int orangefs_symlink(struct inode *dir,
314314
ret = PTR_ERR(inode);
315315
goto out;
316316
}
317+
/*
318+
* This is necessary because orangefs_inode_getattr will not
319+
* re-read symlink size as it is impossible for it to change.
320+
* Invalidating the cache does not help. orangefs_new_inode
321+
* does not set the correct size (it does not know symname).
322+
*/
323+
inode->i_size = strlen(symname);
317324

318325
gossip_debug(GOSSIP_NAME_DEBUG,
319326
"Assigned symlink inode new number of %pU\n",

0 commit comments

Comments
 (0)