Skip to content

Commit

Permalink
fs/affs: bugfix: make symbolic links work again
Browse files Browse the repository at this point in the history
AFFS symbolic links were broken since kernel 2.6.29

Problem was bisected to the following

commit ebd09ab ("vfs: ensure page symlinks are NUL-terminated")
commit 0351468 ("vfs: introduce helper function to safely
NUL-terminate symlinks")

AFFS wasn't setting inode size when reading symbolic link from disk or
creating a new one. Result was zero allocation in pagecache.

ln -s file symlink

ls -lrt

file
symlink ->

This patch adds inode isize information on inode get and symbolic link
addition.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Fabian Frederick authored and Al Viro committed Apr 27, 2017
1 parent 4f7d029 commit f1bf907
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions fs/affs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
inode->i_fop = &affs_file_operations;
break;
case ST_SOFTLINK:
inode->i_size = strlen((char *)AFFS_HEAD(bh)->table);
inode->i_mode |= S_IFLNK;
inode_nohighmem(inode);
inode->i_op = &affs_symlink_inode_operations;
Expand Down
1 change: 1 addition & 0 deletions fs/affs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
symname++;
}
*p = 0;
inode->i_size = i + 1;
mark_buffer_dirty_inode(bh, inode);
affs_brelse(bh);
mark_inode_dirty(inode);
Expand Down

0 comments on commit f1bf907

Please sign in to comment.