mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 17:23:55 +08:00
dax: improve comment about truncate race
Jan Kara pointed out I should be more explicit here about the perils of racing against truncate. The comment is mostly the same as for the PTE case. Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Cc: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
ae18d6dcf5
commit
84c4e5e675
7
fs/dax.c
7
fs/dax.c
@ -553,7 +553,12 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
|
|||||||
if (!buffer_size_valid(&bh) || bh.b_size < PMD_SIZE)
|
if (!buffer_size_valid(&bh) || bh.b_size < PMD_SIZE)
|
||||||
goto fallback;
|
goto fallback;
|
||||||
|
|
||||||
/* Guard against a race with truncate */
|
/*
|
||||||
|
* If a truncate happened while we were allocating blocks, we may
|
||||||
|
* leave blocks allocated to the file that are beyond EOF. We can't
|
||||||
|
* take i_mutex here, so just leave them hanging; they'll be freed
|
||||||
|
* when the file is deleted.
|
||||||
|
*/
|
||||||
size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||||
if (pgoff >= size) {
|
if (pgoff >= size) {
|
||||||
result = VM_FAULT_SIGBUS;
|
result = VM_FAULT_SIGBUS;
|
||||||
|
Loading…
Reference in New Issue
Block a user