]> git.proxmox.com Git - mirror_spl.git/commit
Fix race between getf() and areleasef()
authorRichard Yao <richard.yao@clusterhq.com>
Wed, 4 Nov 2015 21:41:13 +0000 (16:41 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 3 Dec 2015 23:44:47 +0000 (15:44 -0800)
commit1683e75edc1fdca1eba53f16ca08ce32c5e736d1
treeef22c0fa413442cb31df3bb4b5f37c2745a4d7e9
parentd28c5c4f0472e9674d34f8237ba14187669dad7c
Fix race between getf() and areleasef()

If a vnode is released asynchronously through areleasef(), it is
possible for the user process to reuse the file descriptor before
areleasef is called. When this happens, getf() will return a stale
reference, any operations in the kernel on that file descriptor will
fail (as it is closed) and the operations meant for that fd will
never occur from userspace's perspective.

We correct this by detecting this condition in getf(), doing a putf
on the old file handle, updating the file descriptor and proceeding
as if everything was fine. When the areleasef() is done, it will
harmlessly decrement the reference counter on the Illumos file handle.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #492
include/sys/user.h
module/spl/spl-vnode.c