summary refs log tree commit diff
path: root/kernel
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2011-05-14 12:06:42 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-14 12:18:55 -0700
commit05bf86b4ccfd0f197da61c67bd372111d15a6620 (patch)
tree23db61517fad9b68b19fdbe044fa3dbe8fc2bd19 /kernel
parentafa49791caae70cc3fd665a182eea61250795265 (diff)
downloadlinux-05bf86b4ccfd0f197da61c67bd372111d15a6620.tar.gz
tmpfs: fix race between swapoff and writepage
Shame on me!  Commit b1dea800ac39 "tmpfs: fix race between umount and
writepage" fixed the advertized race, but introduced another: as even
its comment makes clear, we cannot safely rely on a peek at list_empty()
while holding no lock - until info->swapped is set, shmem_unuse_inode()
may delete any formerly-swapped inode from the shmem_swaplist, which
in this case would leave a swap area impossible to swapoff.

Although I don't relish taking the mutex every time, I don't care much
for the alternatives either; and at least the peek at list_empty() in
shmem_evict_inode() (a hotter path since most inodes would never have
been swapped) remains safe, because we already truncated the whole file.

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions