OpenAFS Master Repository branch, openafs-stable-1_6_x, updated. openafs-stable-1_6_0b-16-gf4dd94e
Gerrit Code Review
gerrit@openafs.org
Tue, 13 Sep 2011 10:49:25 -0700 (PDT)
The following commit has been merged in the openafs-stable-1_6_x branch:
commit f4dd94edf7384dee912a09354f500d08421f94d4
Author: Andrew Deason <adeason@sinenomine.net>
Date: Wed Aug 24 12:48:19 2011 -0500
ihandle: Fix IH_REALLYCLOSE for positional I/O
Currently, ih_fdclose (which is called by IH_REALLYCLOSE), goes
through every FD_HANDLE_OPEN FdHandle_t and closes it. If it finds
handles that are FD_HANDLE_INUSE, it skips those and sets a flag on
the parent IHandle_t. For non-positional I/O, any future opens cannot
use these _INUSE handles, since _INUSE handles cannot be reused, and
the handle will be actually closed when it is FDH_CLOSE'd.
For positional I/O, the situation is different. Multiple threads can
use the same _INUSE FdHandle_t, and so there is nothing currently
stopping a thread from IH_OPEN'ing an ihandle that has been
IH_REALLYCLOSE'd, and getting back an FdHandle_t that existed before
the IH_REALLYCLOSE was issued. This is important, since IH_REALLYCLOSE
is used on files that are deleted, and future IH_OPENs for the same
inode must not use the cached file descriptor. Getting this wrong can
cause data loss, since it can cause us to read from or write to a file
descriptor referring to a deleted file, when we instead should open a
new copy of that file.
To fix this, we create a new FdHandle_t state called
FD_HANDLE_CLOSING, which is set in IH_REALLYCLOSE if we encounter an
FD_HANDLE_INUSE FdHandle_t. In IH_OPEN, we always skip
FD_HANDLE_CLOSING handles, so we can never get back a cached file
descriptor from before an IH_REALLYCLOSE call.
Reviewed-on: http://gerrit.openafs.org/5308
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 597de25969ebdeaafb7390984b5ce2c8782fd557)
Change-Id: I4ac2e4d10ce20f8575b35385e324b637dffd0671
Reviewed-on: http://gerrit.openafs.org/5404
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/vol/ihandle.c | 18 ++++++++++++++----
src/vol/ihandle.h | 3 +++
2 files changed, 17 insertions(+), 4 deletions(-)
--
OpenAFS Master Repository