Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: use helper function put_write_access()

In commit 1da177e4c3f4 ("Linux-2.6.12-rc2"), the helper put_write_access()
came with the atomic_dec operation of the i_writecount field. But it
forgot to use this helper in __vma_link_file() and dup_mmap().

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Link: https://lkml.kernel.org/r/20200924115235.5111-1-linmiaohe@huawei.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Miaohe Lin and committed by
Linus Torvalds
73eb7f9a e755f4af

+2 -2
+1 -1
kernel/fork.c
··· 556 556 557 557 get_file(file); 558 558 if (tmp->vm_flags & VM_DENYWRITE) 559 - atomic_dec(&inode->i_writecount); 559 + put_write_access(inode); 560 560 i_mmap_lock_write(mapping); 561 561 if (tmp->vm_flags & VM_SHARED) 562 562 mapping_allow_writable(mapping);
+1 -1
mm/mmap.c
··· 619 619 struct address_space *mapping = file->f_mapping; 620 620 621 621 if (vma->vm_flags & VM_DENYWRITE) 622 - atomic_dec(&file_inode(file)->i_writecount); 622 + put_write_access(file_inode(file)); 623 623 if (vma->vm_flags & VM_SHARED) 624 624 mapping_allow_writable(mapping); 625 625