netfs, afs: Fix symlink reading
Subsystems (2)
David Howells
maintainerPATCH 1/1 netfs, afs: Fix symlink reading
Fix the reading of symlinks from the cache in afs by making netfslib trim the amount read down to i_size. The problem is that afs sets the size of the iterator to the size of the buffer (PAGE_SIZE) so that the cache can round the read size up to the cache's DIO size.
Note that this also impacts the reading of AFS mountpoints as they're just stored as symlinks with an odd file mode.
--- fs/netfs/read_collect.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/netfs/read_collect.c +5 -0
@@ -435,6 +435,11 @@ static void netfs_rreq_assess_single(struct netfs_io_request *rreq)netfs_single_mark_inode_dirty (rreq->inode); } +/* To do DIO, the cache has to round the size up, so we need to undo +* the rounding. +*/ + rreq->transferred =min (rreq->transferred, rreq->i_size); +if (rreq->iocb) { rreq->iocb->ki_pos += rreq->transferred;if (rreq->iocb->ki_complete) {
Quoted 8 lines · David Howells
Fix the reading of symlinks from the cache in afs by making netfslib trim the amount read down to
i_size. The problem is that afs sets the size of the iterator to the size of the buffer (PAGE_SIZE) so that the cache can round the read size up to the cache's DIO size.Note that this also impacts the reading of AFS mountpoints as they're just stored as symlinks with an odd file mode.
Quoted 6 lines
Fixes c0410adf3da6 ("afs: Fix the locking used by afs_get_link()")cc Paulo Alcantara <[email protected]>cc Marc Dionne <[email protected]>
Quoted 9 lines · David Howells
Fix the reading of symlinks from the cache in afs by making netfslib trim the amount read down to
i_size. The problem is that afs sets the size of the iterator to the size of the buffer (PAGE_SIZE) so that the cache can round the read size up to the cache's DIO size.Note that this also impacts the reading of AFS mountpoints as they're just stored as symlinks with an odd file mode.
[...]
Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.fixes
[1/1] netfs, afs: Fix symlink reading
https://git.kernel.org/vfs/vfs/c/c51e89c5b5db