Commit Graph

9963 Commits

Author SHA1 Message Date
Marc Dionne
beafc7f742 Linux 3.3: use umode_t for mkdir and create inode ops
The mkdir and create inode operations have switched to using
umode_t instead of int for the file mode.

Change-Id: Ib8bbf6eaa6e87d6a9692c45b1a3fe93fcc3eff7a
Reviewed-on: http://gerrit.openafs.org/6567
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2012-01-18 10:12:40 -08:00
Marc Dionne
64bd0b728c Linux: use standard macro for set_nlink configure test
A generic macro exists to test for functions in the kernel, use
it for set_nlink.

Change-Id: Iaec2b29e48f500bcf7a1ef80a3f2a1305e5dbb8f
Reviewed-on: http://gerrit.openafs.org/6566
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2012-01-18 09:28:23 -08:00
Derrick Brashear
60df98806b volinfo: fix formating of placeholder printfs
needed to placate gcc-llvm on lion

Change-Id: Ie15e4768d2e3feb7ad80dfef05395f2c4a227c0f
Reviewed-on: http://gerrit.openafs.org/6565
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-18 09:27:59 -08:00
Marc Dionne
6ad3d646e6 rx: Correctly test for end of call queue
The intention of this condition is to check if the current call
being considered is the last one on the queue, but the test is
incorrect.  A null next pointer indicates a removed item, not
the end of the queue.

Use the queue_IsLast macro instead to correctly determine that
this is the last item in the queue and that a call has to be
selected, either the current one or a previously seen good choice.

This can cause calls to get permanently stuck in the call queue
and never get assigned to a thread, even when all threads are
idle.

Change-Id: Ie44a45734ab25bd3d2be3635c2e8f05857ca935e
Reviewed-on: http://gerrit.openafs.org/6564
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-18 09:27:44 -08:00
Jeffrey Altman
20151a8699 Windows: disable memory extent interface
There have been reports that the memory extent interface which
is used when NonPersistentCache is active can lead to data corruption.

Change-Id: I3a8acae0648a67534e46c73ef1dcbf7f939a558d
Reviewed-on: http://gerrit.openafs.org/6557
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-18 07:36:36 -08:00
Jeffrey Altman
69196e41ec Windows: restrict service to 2 cpus by default
Performance drops off considerably when the number of processors
increases due to lock contention and the cm_SyncOp wait processing.
If the MaxCPUs registry value is not set, limit ourselves to two.
Setting MaxCPUs to zero permits use of all CPUs.

Change-Id: I4bae328ed589811b0ea2a514501a0c1aa74e8015
Reviewed-on: http://gerrit.openafs.org/6555
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-18 07:35:35 -08:00
Jeffrey Altman
7ae2c0df33 Windows: AFS_SERVER_FLUSH_DELAY AFS_SERVER_PURGE_DELAY
Alter the flush delay to 5 seconds from 30 seconds

Alter the purge delay to 300 seconds from 5 seconds

Change-Id: I3f8e79d84582c4015e35d58cf1bedc9a023c0d73
Reviewed-on: http://gerrit.openafs.org/6554
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-18 07:35:17 -08:00
Jeffrey Altman
f549911027 Windows: AFSParseName edge cases
If the input path is \afs\ behave as if the path is \afs.

If the input path is \afs\*\ detect the wildcard and return
STATUS_OBJECT_NAME_INVALID.

Change-Id: I0ef4f30fb3b6245a52160b5e7f9233bc5f599485
Reviewed-on: http://gerrit.openafs.org/6553
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-18 07:34:56 -08:00
Jeffrey Altman
96b9900d30 Windows: afs root is always a directory
If the root is opened with the FILE_NON_DIRECTORY_FILE option,
fail the request with STATUS_FILE_IS_A_DIRECTORY.

Change-Id: Ic7d29f9032c2a19617276138833938fcf304838e
Reviewed-on: http://gerrit.openafs.org/6552
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-18 07:33:40 -08:00
Ken Dreyer
7fd67cb289 fix spelling in comments
Change-Id: I4b4558833825295bbd16134cbd403a87b1c7b14c
Reviewed-on: http://gerrit.openafs.org/6561
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-17 10:14:26 -08:00
Andrew Deason
fda2fe8538 DAFS: Fix SYNC_FAILED VScheduleSalvage_r log
SYNC_FAILED is not an unknown protocol code, so stop saying it is.

Change-Id: I87ce896fe061e6b5bfd3efdbb442281682a3e652
Reviewed-on: http://gerrit.openafs.org/6530
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-11 13:12:04 -08:00
Andrew Deason
627cfb1d4e vol: Fix VCreateVolume special inode cleanup
In order to dec the relevant special inodes, we need to know the
parent vol id in addition to the vol id itself. Use the appropriate
volume IDs when IH_DEC'ing special inodes after we fail to create the
volume, so we don't leave behind special inodes.

Change-Id: I77cfafac80c49debf46c86faefadd2a586d6f06b
Reviewed-on: http://gerrit.openafs.org/6529
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-11 10:14:23 -08:00
Jeffrey Altman
e77b6858ee Windows: dir buffers out of date - mark them as such
if cm_CheckForSingleDirChange() fails, mark the cm_scache_t
bufDataVersionLow as the current data version so that old directory
buffers are discarded.

Change-Id: I8d587a024027e74e66190fdc993564b640993b4c
Reviewed-on: http://gerrit.openafs.org/6498
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-10 19:53:19 -08:00
Jeffrey Altman
7a25010a6e Windows: Avoid file server rpcs on deleted files
If a file has been deleted, do not attempt to issue RPCs
to the file server in response to AFS redirector extent processing.
All RPCs will fail with VNOVNODE which will in turn trigger invalidation
requests to the AFS redirector which can deadlock.

Change-Id: I85b6b4a0ce619e54df648163392be93761f709f0
Reviewed-on: http://gerrit.openafs.org/6514
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-10 19:52:44 -08:00
Jeffrey Altman
cde0539f79 Windows: use local var for interlocked result
Save the result of the interlocked operations for use in
debug logging.  Do not reference the incremented or decremented
object in the log messages, it may have changed.

Local assignment is provided even in functions that are currently
not logging to assist with debugging and as a reminder to use
the result variable in future log messages.

Change-Id: Ia7ed8bf14b204b265e1db7713b96864634a731d7
Reviewed-on: http://gerrit.openafs.org/6508
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-10 19:52:32 -08:00
Jeffrey Altman
6185532db5 Windows: AFSParseMountPointTarget buffer overrun
When parsing the AFS mount point string do not overrun
the buffer if the colon cell/volume separator is not
found.

Change-Id: Id7275cc8815223730f7c39bd11a6f495beb117c4
Reviewed-on: http://gerrit.openafs.org/6507
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-10 19:52:15 -08:00
Jeffrey Altman
ba4f5afc9c Windows: Directory Enumeration, DVs, and TreeLocks
Hold the TreeLock exclusively across all operations that
enumerate, validate, or otherwise manipulate directory tree
lists or data versions.

Take the data version into account when deciding what to do
with directory data.  If a directory enumeration takes more
than one request to service and the DV has changed from the
time the directory snapshop was taken by the service and the
enumeration completion, merge in the changes and then mark
the directory as requiring verification.

If a directory change operation completes (create, rename, remove)
and the directory DV has changed by more than one force a full
directory verification.

Set the directory data version to -1 whenever a directory
verification is required.  Otherwise, the check to clear the
VERIFY flag will only update the metadata for the directory.

During a directory verification, if a new entry has been discovered
it is added to the directory.  Make sure the VALID flag is set so
that the entry will not immediately be removed as invalid.

Change-Id: I6be8d00126fccf88bde8ae5f97e850dfb9a2f60f
Reviewed-on: http://gerrit.openafs.org/6460
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-10 19:52:01 -08:00
Jeffrey Altman
9783384af7 Windows: correct log messages in AFSCleanup
Change-Id: I1e202547d82195f85e6de20e72f6b07c6c7475ba
Reviewed-on: http://gerrit.openafs.org/6506
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-10 19:51:25 -08:00
Jeffrey Altman
bd09d06c3f Windows: Return Dir Data Version from AFSCleanup
This patchset returns the directory data version from AFSCleanup().
It does not do anything with it.

Change-Id: I86ac37f9e237bfec3ea612b896bec4ed7d43d068
Reviewed-on: http://gerrit.openafs.org/6505
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-10 19:51:11 -08:00
Jeffrey Altman
d2f9f8fa05 Windows: reorg open handle counts and Fcb->NPFcb->Resource
Reorganize when open handle counts are decremented in order
to avoid a race with worker threads performing garbage collection.

Change-Id: I07c1c5e80fad48cd3439dbc9c85bd6dff9b9bf44
Reviewed-on: http://gerrit.openafs.org/6504
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-10 19:50:54 -08:00
Jeffrey Altman
e28d77fc4b Windows: Permit renames of open files
AFS does not impose a restriction on renames of open files.
Failure to permit the rename can cause problems if an anti-malware
service opens the file immediately after the application performing
the rename does so.

Change-Id: Ib23a6a893c5c575e89b8a817faec4c11300a04b7
Reviewed-on: http://gerrit.openafs.org/6503
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-10 19:50:41 -08:00
Jeffrey Altman
b92a676517 Windows: Do not prime the service directory cache
Performing a directory enumeration is an expensive operation
that we should be attempting to avoid.   The current directory
enumeration and evaluate target requests will use inline bulk
status RPCs to the file server which obtain status for 49 items
at a time from a single directory.

Change-Id: I78e08680fec9715c3c446d0c4c5226cd79db80bd
Reviewed-on: http://gerrit.openafs.org/6502
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-10 19:50:29 -08:00
Jeffrey Altman
6ee54eb382 Windows: More specific error values
When a mount point, symlink, or dfslink cannot be resolved
return STATUS_REPARSE_POINT_NOT_RESOLVED.

When an operation fails because the volume is readonly, return
STATUS_MEDIA_WRITE_PROTECTED.

Change-Id: Ib35f0d7851c087bf8aa25d4b0138ee72fb6f3c68
Reviewed-on: http://gerrit.openafs.org/6501
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-10 19:50:13 -08:00
Jeffrey Altman
e5a2f955c7 Windows: do not flush dirty extents without permission
When closing file handles, do not permit dirty extents to be
released back to the service if the current handle (Ccb) does
not have write permission.  The cleanup operation will fail with
STATUS_ACCESS_DENIED, the extents will be released and all of the
dirty data will be discarded.

Change-Id: Iceacf5319147d1bd6277ea160bc67d91f1a49d5b
Reviewed-on: http://gerrit.openafs.org/6500
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-10 19:49:54 -08:00
Derrick Brashear
22005aae24 opr: fix generated target
we need opr for comerr, but we don't want it after. build,
then clean up.

Change-Id: I621f36bc5f6db85720b73b33578975d0dd126a18
Reviewed-on: http://gerrit.openafs.org/6525
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-01-08 18:16:02 -08:00
Marc Dionne
2caf0778dd libuafs: only rebuild h directory when needed
A few changes to allow a "make all ; sudo make install ; make all..."
workflow to work without manually removing files in between.

Make the rebuilding of the h directory dependent on the source
files scanned to build it.  This prevents it from being rebuilt
for every "make install".

While we're here, use -f when removing linktest for the clean target.
This allows "make clean" to remove it without prompting when the user
doesn't have write access to the file, as is the case when make install
rebuilds it as root.

Change-Id: I45b34ad41560ef8c905e6be4201fa438a3cc7bc3
Reviewed-on: http://gerrit.openafs.org/6519
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-01-08 18:15:37 -08:00
Marc Dionne
80a2e6ed74 opr: add buildtools target
opr needs a buildtools target for "make generated". Make it install
the headers, which are needed by the other generated targets.

Change-Id: I34faa81fa84407c5e6e1460dc765d0c2ce1ef3e8
Reviewed-on: http://gerrit.openafs.org/6523
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-08 16:15:28 -08:00
Andrew Deason
967d7201ee Make libjafs buildable again
libjafs is surprisingly close to being buildable. Fix a few misc
things which have bitrotted over the years so it is possible to
actually build:

 - Add -I$SRC/config to the cflags, so we can include afsconfig.h

 - Remove references to the nonexistant rxkstats.o

 - Do not link with UAFS' AFS_component_version_number.o, since this
   gives us duplicate version number symbols

 - Include afs_vosAdmin.h in Group.c, to satisfy some missing symbols

Change-Id: Ie8da88872288073d080a58ed7fe8c8b52052488e
Reviewed-on: http://gerrit.openafs.org/6524
Reviewed-by: Steven Jenkins <steven@synaptian.com>
Tested-by: Steven Jenkins <steven@synaptian.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-08 09:14:39 -08:00
Derrick Brashear
9620b67c13 afs: discard cached state when we are unsure of validity
in the event we got a network error, we don't know if the server
completed (or will complete) our operation. we can assume nothing.
a more complicated version of this could attempt to verify that the
state is what we expect it to be, but in extended callbacks universe
this is potentially easier to solve anyway. for now, return the
error to the caller, and mark the vcache unstat'd.

Change-Id: Iafb67f24b89d78b8236660d047da12fce1dd6061
Reviewed-on: http://gerrit.openafs.org/6510
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-01-07 06:18:35 -08:00
Derrick Brashear
a12527c87a afs: put back conn if not using in checkserver loop
we get a conn, check it for eligibility, and if not,
just abandon it. "oops"

Change-Id: Ie3841c19b05a87fb225c3e8124cd485cba3c3648
Reviewed-on: http://gerrit.openafs.org/6516
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-01-07 06:18:07 -08:00
Derrick Brashear
2a31f35936 rx: add and export a public keepalive toggle
make enabling and disabling keepalives a public function.
export the function

Change-Id: Ia553d91488511edc0b483d95326f14ac0e315332
Reviewed-on: http://gerrit.openafs.org/6517
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-07 06:09:47 -08:00
Chaskiel Grundman
d6876d3d8c Make src/opr objdir safe
Update the Makefile for src/opr to use $? to reference headers, so objdir
builds work correctly

Change-Id: I3d8e0d885715a1d1bc1578f4e8ce69fe4239bb56
Reviewed-on: http://gerrit.openafs.org/6444
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2012-01-06 07:37:28 -08:00
Derrick Brashear
0f4da13137 afs: increase idledead time
it's actually important this be more than the rx call dead time
so timing out server callbacks to clients don't result in us idle deading
a call to the server when callbacks need to be broken

FIXES 130327

Change-Id: Ibe2468edb61f307da9174d2c51cb0ea61c118c56
Reviewed-on: http://gerrit.openafs.org/6497
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-06 04:00:03 -08:00
Derrick Brashear
38b74b34d2 ukernel: enable nat ping again
if we're not root, no nat ping at all. fix that.

Change-Id: I7ea4db77b30ba639921b11c4ccad35a2e14133b4
Reviewed-on: http://gerrit.openafs.org/6509
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-04 18:11:29 -08:00
Simon Wilkinson
e3c8bd4574 afs: Negate codes using a clear, standard method
The bulk of our code uses 'code = -code' to negate an error code.
Use this, rather than 'code *= -1', as the latter form makes my
head hurt.

Change-Id: I578fbd7c123c37d89ceb1a6373409feb8b619d86
Reviewed-on: http://gerrit.openafs.org/6511
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-04 18:10:50 -08:00
Marc Dionne
52944ff61a Use offsetof() in set_header_word to get field offset
Use offsetof() to replace a few instances where the same logic is
open coded in set_header_word and inc_header_word macros.  In cases
where the field name involves a variable as an index to an array,
newer gcc gives a sequence point warning.

Change-Id: I43e3d6ef6a63b51003496a1beb72c445a9109615
Reviewed-on: http://gerrit.openafs.org/6513
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-04 18:10:09 -08:00
Marc Dionne
d4fba5f92d vol: initialize readmeinode
Newer gcc complains about readmeinode being potentially used
uninitialized.  Doesn't look possible in the code, but initialize
it to quiet the warning.

Change-Id: I7172475a64a3bfb90a76c0266d7812d5d42a2c4c
Reviewed-on: http://gerrit.openafs.org/6512
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-04 18:08:34 -08:00
Michael Meffie
faa58c9f60 Unix CM: reset blacklist on hard-mount retry
Reset black-listed servers on a request when retrying due to a
hard-mount retry. When hard-mounts are in effect, a request may
retry indefinitely. If all the servers have been black-listed
due to a transient error, the request may never complete.

Change-Id: I2510f729cbbb21836b139c94e25867118a6ad873
Reviewed-on: http://gerrit.openafs.org/6330
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-03 10:37:52 -08:00
Andrew Deason
8e15e16c9e DAFS: Atomically re-hash vnode in VGetFreeVnode_r
VGetFreeVnode_r pulls a vnode off of the vnode LRU, and removes the
vnode from the vnode hash table. In DAFS, we may drop the volume glock
immediately afterwards in order to close the ihandle for the old vnode
structure.

While we have the glock dropped, another thread may try to
VLookupVnode for the new vnode we are creating, find that it is not
hashed, and call VGetFreeVnode_r itself. This can result in two
threads having two separate copies of the same vnode, which bypasses
any mutual exclusion ensured by per-vnode locks, since they will lock
their own version of the vnode. This can result in a variety of
different problems where two threads try to write to the same vnode at
the same time. One example is calling CopyOnWrite on the same file in
parallel, which can cause link undercounts, writes to the wrong vnode
tag, and other CoW-related errors.

To prevent all this, make VGetFreeVnode_r atomically remove the old
vnode structure from the relevant hashes, and add it to the new hashes
before dropping the glock. This ensures that any other thread trying
to load the same vnode will see the new vnode in the hash table,
though it will not yet be valid until the vnode is loaded.

Note that this only solves this race for DAFS. For non-DAFS, the vol
glock is held over the ihandle close, so this race does not exist.
The comments around the callers of VGetFreeVnode_r indicate that
similar extant races exist here for non-DAFS, but they are unsolvable
without significant DAFS-like changes to the vnode package.

Change-Id: I84c5d1bdd29f9e7140e905388b4b65629932c951
Reviewed-on: http://gerrit.openafs.org/6385
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-03 07:59:17 -08:00
Andrew Deason
7461fa1193 afs: Grab a reference to setp in afs_icl_Event4
We can drop GLOCK in several places in afs_icl_Event4 and the
afs_icl_AppendRecord callee. To ensure that the given afs_icl_set does
not get freed while we have GLOCK dropped, grab a reference to the
set.

Thanks to Ryan C. Underwood for reporting an issue triggered by this.

Change-Id: Ifeda229b444abd75b0f22c7acf18a7553d833964
Reviewed-on: http://gerrit.openafs.org/6431
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2012-01-03 07:30:33 -08:00
Geoffrey Thomas
267934d0e6 linux: fsync on a directory should return 0, not EINVAL
Directory writes are synchronous, so this is fine. There's a
mostly-convenient function in fs/libfs.c that returns 0 that we can use
to do what we want ("mostly" because it was renamed in 2.6.35).

FIXES 130425

Change-Id: I9a2af60ed3152be036f0145c94152d8cff2e1242
Reviewed-on: http://gerrit.openafs.org/6491
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-03 07:26:06 -08:00
Geoffrey Thomas
dee93ff1d1 rpm: Don't attempt to restart on upgrade when using systemd
systemd is actually rather capable of leaving the OpenAFS client in an
incredibly broken state, thanks to its willingness to track services and
kill their processes. We should not attempt to restart the client on
upgrade, whether a normal upgrade or a migration from SysV initscripts.
In the former case, it's fine (and correct) for the old AFS to keep
running; in the latter case, the unit file is capable of correctly
shutting down an initscript-launched client. The same is true for the
OpenAFS server.

This brings the packaging in line with the SysV initscript code in the
specfile, which does not attempt to restart the service, as well as with
e.g. Debian's packaging, which uses --no-restart-on-upgrade.

While we're here, clean up a redundant BuildRequires on systemd-units.

Change-Id: I3b1771a7246f04be0e82765976664c50e0adae47
Reviewed-on: http://gerrit.openafs.org/6247
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-01-03 07:25:12 -08:00
Peter Scott
af08b74511 Windows: Support correct status codes from service
When performing object verification, check for status failures corresponding
to parent object issues which require a validation of the parent

Change-Id: I4a73b55961eda62079c933f9e85888ea24b39f1f
Reviewed-on: http://gerrit.openafs.org/6447
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2011-12-31 13:44:56 -08:00
Peter Scott
52c3bace5a Windows: Handle invalid node types
In the case where the direntry data is invalid, construct an Fcb
of type INVALID so that the direntry can be displayed and the objected
deleted even if it cannot be evaluated.

Change-Id: I37da154b7429929fe833874c7cd048a3a804a96f
Reviewed-on: http://gerrit.openafs.org/6445
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2011-12-31 13:44:44 -08:00
Jeffrey Altman
ac56cd9e61 Windows: AFSFileUpdateResultCB ParentDataVersion
Add the parent directory data version to the AFSFileUpdateResultCB
structure.

Change-Id: Ia1b1345c410ff216b35f3d42912ac921b978a299
Reviewed-on: http://gerrit.openafs.org/6459
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2011-12-31 13:44:30 -08:00
Jeffrey Altman
85f4971f85 Windows: renames that overwrite existing target
The Windows client up to this point has never correctly implemented
directory renames.  For the longest time it assumed that the file
server would not replace a pre-existing target.  As a result, when
the target name was already in use the contents of the directory
would end up with the target name existing but its previous file id
associated with it.

A second problem was that lookups for the source and target names
were not performed while the directory (or directories) were exclusively
held to ensure that competing changes could not occur.

This patchset corrects both issues in cm_Rename() and adjusts the
redirector interface to match the new behavior.

Change-Id: I4f5cff7debcf9925947ac3fc6931565acb57ebd9
Reviewed-on: http://gerrit.openafs.org/6457
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2011-12-31 13:44:18 -08:00
Jeffrey Altman
d64983bab0 Windows: AFSDirEnumResp and AFSDirEnumEntry changes
A directory enumeration is not an atomic operation.  The redirector
reads an enumeration a chunk at a time.  During the entire enumeration
it is possible that the data version of the directory object has
changed due to entries being added or removed.  This patchset adds
two data version values to the AFSDirEnumResp structure.

The first is the snapshot data version which is the dv of the
directory object at the time the entry list snapshot was taken.
The second is the current data version number of the directory
object.

If an object has been removed from the directory after the snapshot
was taken, attempts to fetch status information for the object will
fail with a VNOVNODE (aka CM_ERROR_BADFD aka STATUS_INVALID_HANDLE).
The NTStatus field has been added to the AFSDirEnumEntry structure
to permit notifying the redirector of such failures.

RDR_PopulateCurrentEntry() has been extended with an additional
cm_Error parameter that accepts the errorCode field provided by
the cm_direnum_entry_t object constructed during the enumeration.

Change-Id: Iee8f6bf9919780ce4dd6c2b184810c0d6afc39cc
Reviewed-on: http://gerrit.openafs.org/6455
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2011-12-31 13:44:03 -08:00
Jeffrey Altman
f142b615bb Windows: Add AFSFileEvalResultCB
In response to AFS_REQUEST_TYPE_EVAL_TARGET_BY_ID and
AFS_REQUEST_TYPE_EVAL_TARGET_BY_NAME, return the new AFSFileEvalResultCB
instead of a raw AFSDirEnumEntry.   AFSFileEvalResultCB includes
the data version number of the parent directory at the time the
node was evaluated.

Change-Id: Ida25790688f8ab193c234c9b3fadf4f594edd740
Reviewed-on: http://gerrit.openafs.org/6454
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2011-12-31 13:43:52 -08:00
Jeffrey Altman
ccd6614c8f Windows: Add AFSFileCleanupResultCB
Add AFSFileCleanupResultCB which includes the parent directory
data version number.  This is necessary because object deletion occurs
during the Cleanup processing and the redirector needs to know the
resulting data version of the affected directory.

Change-Id: Iac07ddaaa3e3373f1690c85d247313e070450169
Reviewed-on: http://gerrit.openafs.org/6453
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2011-12-31 13:43:42 -08:00
Jeffrey Altman
9115c437c4 Windows: STATUS_OBJECT_PATH_INVALID == invalid parent directory
Modify evaluation of nodes by name and id to consistently return
STATUS_OBJECT_PATH_INVALID if the parent FID no longer exists.

Change-Id: I94f56e5b525a35279152f6f7848654a56bbfa235
Reviewed-on: http://gerrit.openafs.org/6446
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2011-12-31 13:43:31 -08:00