afs: Fix mmap
Subsystems (2)
David Howells
maintainerPATCH 1/1 afs: Fix mmap
Hi Linus,
Could you apply this patch please? Note the odd email address in the Reported-by and Tested-by fields. That's an attempt to note Auristor's internal testcase ID for their tracking purposes. Is this a reasonable way to do it? It's kind of modelled on what syzbot does. Would it be preferable to use some other field or a comment after the Reported-by instead?
David
---
afs: Fix mmap
Fix afs_add_open_map() to check that the vnode isn't already on the list when it adds it. It's possible that afs_drop_open_mmap() decremented the cb_nr_mmap counter, but hadn't yet got into the locked section to remove it.
Also vnode->cb_mmap_link should be initialised, so fix that too.
--- fs/afs/file.c | 5 +++-- fs/afs/super.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
fs/afs/file.c +3 -2
@@ -514,8 +514,9 @@ static void afs_add_open_mmap(struct afs_vnode *vnode)if (atomic_inc_return (&vnode->cb_nr_mmap) ==1 ) {down_write (&vnode->volume->cell->fs_open_mmaps_lock); -list_add_tail (&vnode->cb_mmap_link, - &vnode->volume->cell->fs_open_mmaps); +if (list_empty (&vnode->cb_mmap_link)) +list_add_tail (&vnode->cb_mmap_link, + &vnode->volume->cell->fs_open_mmaps);up_write (&vnode->volume->cell->fs_open_mmaps_lock); }
fs/afs/super.c +1 -0
@@ -667,6 +667,7 @@ static void afs_i_init_once(void *_vnode)INIT_LIST_HEAD (&vnode->pending_locks);INIT_LIST_HEAD (&vnode->granted_locks);INIT_DELAYED_WORK (&vnode->lock_work, afs_lock_work); +INIT_LIST_HEAD (&vnode->cb_mmap_link);seqlock_init (&vnode->cb_lock); }
Linus Torvalds
AppliedQuoted 5 lines · David Howells
Could you apply this patch please? Note the odd email address in the Reported-by and Tested-by fields. That's an attempt to note Auristor's internal testcase ID for their tracking purposes. Is this a reasonable way to do it? It's kind of modelled on what syzbot does.
Yeah, this looks sane to me.
I don't like bare bug tracking IDs that don't tell anybody else anything, but the "embedding it in the email" trick means that it now
(a) gives a contact for it so that it contains meaningful information and (b) also acts a "namespace" for the testcase ID.
Applied.
Linus