lkml.org 
[lkml]   [2018]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/2] hugetlbfs: Use i_mmap_rwsem to fix page fault/truncate race
On Fri, Dec 21, 2018 at 02:17:32PM -0800, Mike Kravetz wrote:
> Am I misunderstanding your question/concern?

No. Thanks for the clarification.

>
> I have decided to add the locking (although unnecessary) with something like
> this in hugetlbfs_evict_inode.
>
> /*
> * The vfs layer guarantees that there are no other users of this
> * inode. Therefore, it would be safe to call remove_inode_hugepages
> * without holding i_mmap_rwsem. We acquire and hold here to be
> * consistent with other callers. Since there will be no contention
> * on the semaphore, overhead is negligible.
> */
> i_mmap_lock_write(mapping);
> remove_inode_hugepages(inode, 0, LLONG_MAX);
> i_mmap_unlock_write(mapping);

LGTM.

--
Kirill A. Shutemov

\
 
 \ /
  Last update: 2018-12-22 23:15    [W:0.059 / U:1.192 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site