Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 335795
b: refs/heads/master
c: 215c02b
h: refs/heads/master
i:
  335793: a142deb
  335791: 84589b2
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Nov 16, 2012
1 parent 1ffbc7d commit bf7b34d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 498c2280212327858e521e9d21345d4cc2637f54
refs/heads/master: 215c02bc33bbd5ff4d7379a909462d11f0103218
16 changes: 14 additions & 2 deletions trunk/mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,8 +1145,20 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
if (!error) {
error = shmem_add_to_page_cache(page, mapping, index,
gfp, swp_to_radix_entry(swap));
/* We already confirmed swap, and make no allocation */
VM_BUG_ON(error);
/*
* We already confirmed swap under page lock, and make
* no memory allocation here, so usually no possibility
* of error; but free_swap_and_cache() only trylocks a
* page, so it is just possible that the entry has been
* truncated or holepunched since swap was confirmed.
* shmem_undo_range() will have done some of the
* unaccounting, now delete_from_swap_cache() will do
* the rest (including mem_cgroup_uncharge_swapcache).
* Reset swap.val? No, leave it so "failed" goes back to
* "repeat": reading a hole and writing should succeed.
*/
if (error)
delete_from_swap_cache(page);
}
if (error)
goto failed;
Expand Down

0 comments on commit bf7b34d

Please sign in to comment.