]> git.baikalelectronics.ru Git - kernel.git/commit
kernfs: invoke kernfs_unmap_bin_file() directly from kernfs_deactivate()
authorTejun Heo <tj@kernel.org>
Mon, 3 Feb 2014 19:02:57 +0000 (14:02 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Feb 2014 23:42:40 +0000 (15:42 -0800)
commit920db7e0dca3134d077eece451305dde343085ad
tree744c59c27e0883dca4da631118432a8df86ce894
parent8903383d1e8c53c03c883fd029c6c3a583fabf8c
kernfs: invoke kernfs_unmap_bin_file() directly from kernfs_deactivate()

kernfs_unmap_bin_file() is supposed to unmap all memory mappings of
the target file before kernfs_remove() finishes; however, it currently
is being called from kernfs_addrm_finish() and has the same race
problem as the original implementation of deactivation when there are
multiple removers - only the remover which snatches the node to its
addrm_cxt->removed list is guaranteed to wait for its completion
before returning.

It can be easily fixed by moving kernfs_unmap_bin_file() invocation
from kernfs_addrm_finish() to kernfs_deactivated().  The function may
be called multiple times but that shouldn't do any harm.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/kernfs/dir.c