]> git.baikalelectronics.ru Git - kernel.git/commit
make ext2_get_page() and friends work without external serialization
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 22 Apr 2016 19:06:44 +0000 (15:06 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 2 May 2016 23:47:25 +0000 (19:47 -0400)
commit0e026e684399b6ab6e8fa4504b841ba685b9d9e8
treea65508f3456f623f51215581e3b00529a9c20ee7
parentd35b41cb5c613c8fc81ead3399bf0cdca6dc6531
make ext2_get_page() and friends work without external serialization

Right now ext2_get_page() (and its analogues in a bunch of other filesystems)
relies upon the directory being locked - the way it sets and tests Checked and
Error bits would be racy without that.  Switch to a slightly different scheme,
_not_ setting Checked in case of failure.  That way the logics becomes
if Checked => OK
else if Error => fail
else if !validate => fail
else => OK
with validation setting Checked or Error on success and failure resp. and
returning which one had happened.  Equivalent to the current logics, but unlike
the current logics not sensitive to the order of set_bit, test_bit getting
reordered by CPU, etc.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/afs/dir.c
fs/exofs/dir.c
fs/ext2/dir.c
fs/nilfs2/dir.c
fs/ufs/dir.c