|
47 | 47 | #include <linux/splice.h> |
48 | 48 | #include <linux/rcupdate_wait.h> |
49 | 49 | #include <linux/sched/mm.h> |
50 | | -#include <linux/fsnotify.h> |
51 | 50 | #include <asm/pgalloc.h> |
52 | 51 | #include <asm/tlbflush.h> |
53 | 52 | #include "internal.h" |
@@ -3198,14 +3197,6 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf) |
3198 | 3197 | unsigned long vm_flags = vmf->vma->vm_flags; |
3199 | 3198 | unsigned int mmap_miss; |
3200 | 3199 |
|
3201 | | - /* |
3202 | | - * If we have pre-content watches we need to disable readahead to make |
3203 | | - * sure that we don't populate our mapping with 0 filled pages that we |
3204 | | - * never emitted an event for. |
3205 | | - */ |
3206 | | - if (unlikely(FMODE_FSNOTIFY_HSM(file->f_mode))) |
3207 | | - return fpin; |
3208 | | - |
3209 | 3200 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
3210 | 3201 | /* Use the readahead code, even if readahead is disabled */ |
3211 | 3202 | if ((vm_flags & VM_HUGEPAGE) && HPAGE_PMD_ORDER <= MAX_PAGECACHE_ORDER) { |
@@ -3274,10 +3265,6 @@ static struct file *do_async_mmap_readahead(struct vm_fault *vmf, |
3274 | 3265 | struct file *fpin = NULL; |
3275 | 3266 | unsigned int mmap_miss; |
3276 | 3267 |
|
3277 | | - /* See comment in do_sync_mmap_readahead. */ |
3278 | | - if (unlikely(FMODE_FSNOTIFY_HSM(file->f_mode))) |
3279 | | - return fpin; |
3280 | | - |
3281 | 3268 | /* If we don't want any read-ahead, don't bother */ |
3282 | 3269 | if (vmf->vma->vm_flags & VM_RAND_READ || !ra->ra_pages) |
3283 | 3270 | return fpin; |
@@ -3336,48 +3323,6 @@ static vm_fault_t filemap_fault_recheck_pte_none(struct vm_fault *vmf) |
3336 | 3323 | return ret; |
3337 | 3324 | } |
3338 | 3325 |
|
3339 | | -/** |
3340 | | - * filemap_fsnotify_fault - maybe emit a pre-content event. |
3341 | | - * @vmf: struct vm_fault containing details of the fault. |
3342 | | - * |
3343 | | - * If we have a pre-content watch on this file we will emit an event for this |
3344 | | - * range. If we return anything the fault caller should return immediately, we |
3345 | | - * will return VM_FAULT_RETRY if we had to emit an event, which will trigger the |
3346 | | - * fault again and then the fault handler will run the second time through. |
3347 | | - * |
3348 | | - * Return: a bitwise-OR of %VM_FAULT_ codes, 0 if nothing happened. |
3349 | | - */ |
3350 | | -vm_fault_t filemap_fsnotify_fault(struct vm_fault *vmf) |
3351 | | -{ |
3352 | | - struct file *fpin = NULL; |
3353 | | - int mask = (vmf->flags & FAULT_FLAG_WRITE) ? MAY_WRITE : MAY_ACCESS; |
3354 | | - loff_t pos = vmf->pgoff >> PAGE_SHIFT; |
3355 | | - size_t count = PAGE_SIZE; |
3356 | | - int err; |
3357 | | - |
3358 | | - /* |
3359 | | - * We already did this and now we're retrying with everything locked, |
3360 | | - * don't emit the event and continue. |
3361 | | - */ |
3362 | | - if (vmf->flags & FAULT_FLAG_TRIED) |
3363 | | - return 0; |
3364 | | - |
3365 | | - /* No watches, we're done. */ |
3366 | | - if (likely(!FMODE_FSNOTIFY_HSM(vmf->vma->vm_file->f_mode))) |
3367 | | - return 0; |
3368 | | - |
3369 | | - fpin = maybe_unlock_mmap_for_io(vmf, fpin); |
3370 | | - if (!fpin) |
3371 | | - return VM_FAULT_SIGBUS; |
3372 | | - |
3373 | | - err = fsnotify_file_area_perm(fpin, mask, &pos, count); |
3374 | | - fput(fpin); |
3375 | | - if (err) |
3376 | | - return VM_FAULT_SIGBUS; |
3377 | | - return VM_FAULT_RETRY; |
3378 | | -} |
3379 | | -EXPORT_SYMBOL_GPL(filemap_fsnotify_fault); |
3380 | | - |
3381 | 3326 | /** |
3382 | 3327 | * filemap_fault - read in file data for page fault handling |
3383 | 3328 | * @vmf: struct vm_fault containing details of the fault |
@@ -3481,37 +3426,6 @@ vm_fault_t filemap_fault(struct vm_fault *vmf) |
3481 | 3426 | * or because readahead was otherwise unable to retrieve it. |
3482 | 3427 | */ |
3483 | 3428 | if (unlikely(!folio_test_uptodate(folio))) { |
3484 | | - /* |
3485 | | - * If this is a precontent file we have can now emit an event to |
3486 | | - * try and populate the folio. |
3487 | | - */ |
3488 | | - if (!(vmf->flags & FAULT_FLAG_TRIED) && |
3489 | | - unlikely(FMODE_FSNOTIFY_HSM(file->f_mode))) { |
3490 | | - loff_t pos = folio_pos(folio); |
3491 | | - size_t count = folio_size(folio); |
3492 | | - |
3493 | | - /* We're NOWAIT, we have to retry. */ |
3494 | | - if (vmf->flags & FAULT_FLAG_RETRY_NOWAIT) { |
3495 | | - folio_unlock(folio); |
3496 | | - goto out_retry; |
3497 | | - } |
3498 | | - |
3499 | | - if (mapping_locked) |
3500 | | - filemap_invalidate_unlock_shared(mapping); |
3501 | | - mapping_locked = false; |
3502 | | - |
3503 | | - folio_unlock(folio); |
3504 | | - fpin = maybe_unlock_mmap_for_io(vmf, fpin); |
3505 | | - if (!fpin) |
3506 | | - goto out_retry; |
3507 | | - |
3508 | | - error = fsnotify_file_area_perm(fpin, MAY_ACCESS, &pos, |
3509 | | - count); |
3510 | | - if (error) |
3511 | | - ret = VM_FAULT_SIGBUS; |
3512 | | - goto out_retry; |
3513 | | - } |
3514 | | - |
3515 | 3429 | /* |
3516 | 3430 | * If the invalidate lock is not held, the folio was in cache |
3517 | 3431 | * and uptodate and now it is not. Strange but possible since we |
|
0 commit comments