Skip to content

Commit

Permalink
mm/filemap.c: enable error injection at add_to_page_cache()
Browse files Browse the repository at this point in the history
Recently I messed up the error handling in filemap_fault() because of an
unexpected ENOMEM (related to cgroup memory limits) in add_to_page_cache.
Enable error injection at this point so I can add a testcase to xfstests
to verify I don't mess this up again.

[[email protected]: include linux/error-injection.h]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Josef Bacik <[email protected]>
Reviewed-by: William Kucharski <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
josefbacik authored and torvalds committed May 14, 2019
1 parent c6d2341 commit cfcbfb1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/pagemap.h>
#include <linux/file.h>
#include <linux/uio.h>
#include <linux/error-injection.h>
#include <linux/hash.h>
#include <linux/writeback.h>
#include <linux/backing-dev.h>
Expand Down Expand Up @@ -882,6 +883,7 @@ static int __add_to_page_cache_locked(struct page *page,
put_page(page);
return xas_error(&xas);
}
ALLOW_ERROR_INJECTION(__add_to_page_cache_locked, ERRNO);

/**
* add_to_page_cache_locked - add a locked page to the pagecache
Expand Down

0 comments on commit cfcbfb1

Please sign in to comment.