fs/affs: bugfix: make symbolic links work again
authorFabian Frederick <fabf@skynet.be>
Sat, 15 Apr 2017 06:54:36 +0000 (08:54 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 27 Apr 2017 03:54:05 +0000 (23:54 -0400)
AFFS symbolic links were broken since kernel 2.6.29

Problem was bisected to the following

commit ebd09abbd969 ("vfs: ensure page symlinks are NUL-terminated")
commit 035146851cfa ("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>
fs/affs/inode.c
fs/affs/namei.c

index abcc59899229c68165b9bcf0830885ecf707ecac..fd4ef3c40e4054ba9f23dec2198b650ef53e4cae 100644 (file)
@@ -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;
index 96dd1d09a2735676f51b94ff9390bbc114cf8367..b02da4d421cc1e008d0ba9dc46d03679df367b2d 100644 (file)
@@ -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);