8710 Commits

Author SHA1 Message Date
Jeffrey Altman
9d27d4707c Windows: refactor volume location updates
Break out the VL_GetEntryByName RPC calls into support
functions so we can reduce the amount of duplicated code.

Reviewed-on: http://gerrit.openafs.org/5329
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
(cherry picked from commit 9563dd68fc1fb4b86016106aaacd33732d4cf6ed)

Change-Id: I7fc8b9ac2902c0909b39c446468307fba30b2a51
Reviewed-on: http://gerrit.openafs.org/6020
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2011-11-15 05:46:57 -08:00
Jeffrey Altman
5345695a87 Windows: netidmgr krb5_cc_get_principal can fail
Do not dereference a NULL pointer if krb5_cc_get_principal fails.

On master this bug is fixed by e55d1774b1b5b27a3617467b5e2a24ee2be3a38c
but that change is after the conversion to the Kerberos Compatibility
SDK and cannot be applied to openafs-stable-1_6_x.

Change-Id: I646011dd3171fd1aa6f40f349329f8261546b809
Reviewed-on: http://gerrit.openafs.org/6019
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
2011-11-14 12:51:38 -08:00
Andrew Deason
0de4f7ca6a volser: Remove debugging log messages
While the -log option to volserver is supposed to print additional log
information, it shouldn't spam the log with useless data. Remove some
of the log lines that are really more "debug" information, so we log
the same amount of information as in the 1.4 series.

Reviewed-on: http://gerrit.openafs.org/5810
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 2a1251c5d0c1b0fd4024d7b3282187a838b551fd)

Change-Id: I1af47fa1910a98a6175f1f000d0432af1e1126e8
Reviewed-on: http://gerrit.openafs.org/5831
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-11-11 04:40:53 -08:00
Simon Wilkinson
4ff4ec8ac9 rx: Don't clear the receive queue when out of packets
We can end up discarding a receive queue that's been soft acked,
effectively taking back soft acks we sent. Whilst the RX
documentation says that a client can drop soft acked packets at
will, our RX implementation assumes that if the final packet in
a call has been soft acked, we won't clear the queue. If a client
clears the queue in this situation, the call will hang.

What *should* happen is that we should take necessary locks,
confirm that we have not soft-acked all of the packets in a flow,
and then discard, or, if we're just going to discard, error the
call.

Reviewed-on: http://gerrit.openafs.org/5603
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry-picked from f722a75fe21963d64217375f1f7bbb0eb14befb4)

Change-Id: Ie2f14a0ed7b6d258a7f456387df44ac95fd1748c
Reviewed-on: http://gerrit.openafs.org/5820
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-11-08 19:40:11 -08:00
Andrew Deason
7b1f8cf378 afs: Only use actual connections for GetTime calls
The for() loop that makes an RXAFS_GetTime call in afs_CheckServers
was iterating over conns and rxconns from 0 to j. However, 'j' here is
just the size of the allocated array, whereas 'nconns' is the number
of structures in the array actually initialized. So, just go up to
nconns to avoid using unitialized connections and Rx connections.

This is a 1.6-only change. On master, the -settime code has been
completely removed in change
Id291f5f88b1ad84594706f2a1a02a933dddd0cb9.

Issue reported by Sebastian Hanigk.

Change-Id: Iec782a4464899b5a7e49e193b04f79e31c6b37f2
Reviewed-on: http://gerrit.openafs.org/5788
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-11-04 08:03:14 -07:00
Adam Megacz
1faea6e599 make bozo honor -rxbind correctly
Bozo needs to call rxInitHost() rather than rxInit() when -rxbind is
present. This patch causes it to read NetInfo/NetRestrict earlier in
the startup process so it can make that decision.

FIXES 57286

Reviewed-on: http://gerrit.openafs.org/4729
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 6260c4ae51e7a2807596ddf1bd49620f98eed94c)

Change-Id: If873686f7a7742f82fd5fadf43c6f44379448c29
Reviewed-on: http://gerrit.openafs.org/5771
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:45:11 -07:00
Andrew Deason
3519bdd1cb Suppress cmp component version error messages
When we use cmp to determine whether to replace
AFS_component_version_number.c, suppress stderr in addition to stdout,
to slightly reduce output during the build.

Reviewed-on: http://gerrit.openafs.org/4471
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 21578144e08d46eeec9a2944e92e8d0d7a6dba57)

Change-Id: Ie06f293e3750abb7514ee3795c1af41a26f46642
Reviewed-on: http://gerrit.openafs.org/5770
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:44:53 -07:00
Andrew Deason
4f1421187e viced: Check vnode length on dir ops
The commit aadf69eabb1962496fa93745ab560a5b48cacd61 added checks on
vnode length whenever we read or write from a vnode. Add the same
check on directory vnodes when we modify the directory (whenever
entries are added or deleted).

Reviewed-on: http://gerrit.openafs.org/4233
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 2578555d7e08131bf2fe4cdd0aa4b32567a76eb2)

Change-Id: I105f0dc7b480f7328205ae02929f6ca187aa962a
Reviewed-on: http://gerrit.openafs.org/5769
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:44:41 -07:00
Andrew Deason
f01f6a9cae viced: Check vnode length on read and write
When reading or writing a file vnode, check that the length of the
vnode in the vnode index matches the size of the on-disk file
containing the data for the file. If it does not match, take the
volume offline (and for DAFS, demand-salvage it).

Reviewed-on: http://gerrit.openafs.org/4121
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit aadf69eabb1962496fa93745ab560a5b48cacd61)

Change-Id: I324dc79a24fc8c199825ffefcc1dd2b0097942a1
Reviewed-on: http://gerrit.openafs.org/5768
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:44:28 -07:00
Andrew Deason
650223868c DAFS: DFlushVolume outside of vol glock
DFlushVolume may traverse a long list of directory objects, and can
even hit the disk, so we should drop the glock for it. This should be
safe in DAFS, since we already transition the volume to an exclusive
state before doing this, and DFlushVolume only deals with structures
internal to the directory package and maintains its own locking.

Reviewed-on: http://gerrit.openafs.org/4242
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit a18175f479437f3a4fe68460538927630070cd13)

Change-Id: I355c53c6f224c5471da70827f30511986abeac27
Reviewed-on: http://gerrit.openafs.org/5767
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:44:19 -07:00
Andrew Deason
c096127f73 afs: Retry unlock after afs_StoreAllSegments
HandleFlock calls afs_StoreAllSegments when unlocking an exclusive
flock lock. This can drop the write lock on avc, so we must
effectively retry the entire lock operation again, since the world may
have changed while we were waiting to reacquire the lock on avc. So,
retry once all of the lock checks up to that point, to ensure that a
lock on the file actually still exists.

FIXES 125446

Reviewed-on: http://gerrit.openafs.org/4393
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 601fcf1d7f7c88cfc0ffd877c5458340b3e59098)

Change-Id: Ibd215d586485d8f18f77665f5f85e6bee579e35e
Reviewed-on: http://gerrit.openafs.org/5766
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:44:08 -07:00
Andrew Deason
741bea05a3 afs: Avoid memory leak on recursive write flock
When a process requests an exclusive lock on a file on which it
already holds an exclusive lock, we basically form a no-op. However,
HandleFlock was allocating a new SimpleLocks and attaching it to
avc->slocks, without freeing the old SimpleLocks structure.

Since we don't need to do anything if we already hold an exclusive
lock, just break out of the loop right away when we detect that
scenario. Thus we avoid adding a new structure to avc->slocks, and we
avoid a memory leak.

Reviewed-on: http://gerrit.openafs.org/4395
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit ba9ae1ed7c269d7c080b5ce99b3b4bb2fe0a2a6f)

Change-Id: I9e45a51e02774c555c6d5cb5ba9d0407b8442215
Reviewed-on: http://gerrit.openafs.org/5765
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:43:56 -07:00
Jeffrey Altman
09159b5cc3 vol: avoid MAXINT redefinition warning in vnode.c
Reviewed-on: http://gerrit.openafs.org/4179
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit b1d51d2a6030fb8aabdae1fedb6846dc7ef9fbca)

Change-Id: I8ea833cca442c67468982da31ed1b6fe04508a34
Reviewed-on: http://gerrit.openafs.org/5764
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:43:44 -07:00
Andrew Deason
5c2e87190c DAFS: Correct FSYNC_VOL_QUERY_VOP checks
Check that the given partition matches the vp partition, and ensure
the vp is not in an exclusive state when we check the state.
Otherwise, we may return pending vol ops for a volume on a different
partition, or we may incorrectly return that there is no pending vol
op when in fact the volume does not exist at all.

Reviewed-on: http://gerrit.openafs.org/4308
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 8234cc254406173a7ada9fb1b4a63ca8aa626bca)

Change-Id: I912c1d0b34fbbaae9ce4bd8edf6e3dd7f718be00
Reviewed-on: http://gerrit.openafs.org/5763
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:43:04 -07:00
Andrew Deason
66a63e1647 salvager: Give back volumes when exiting early
Sometimes the salvager exits a bit earlier than normal. For instance,
when no applicable inodes are found for a volume group, or if the
-inodes command line option was given. In these cases, we have already
checked out singleVolumeNumber from the fileserver (if we're salvaging
a single VG), so we need to give it back. So, give it back in those
instances.

Reviewed-on: http://gerrit.openafs.org/4297
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 637f5b642aaee3a6f4642fd0ba15e2a9eec6c496)

Change-Id: Ib40ffb84fa6c40cfd692c561b913decb97268403
Reviewed-on: http://gerrit.openafs.org/5762
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:34:25 -07:00
Andrew Deason
65050695a9 DAFS: Do not record vol ops for DELETED vols
When a volume is VOL_STATE_DELETED, it effectively does not exist, so
there is little point in recording a vp->pending_vol_op structure for
it. Just let callers checkout the volume as they would a nonexistent
volume: without recording anything about the operation.

This just reduces some edge cases and confusing debugging info, so we
don't have to worry about cleaning up pending_vol_op structures for
nonexistent volumes.

Reviewed-on: http://gerrit.openafs.org/4296
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit dba991728ba5a90af316928348053189dac80398)

Change-Id: Ica0c53e62ed885710210c7e1344e12b382302572
Reviewed-on: http://gerrit.openafs.org/5761
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:33:44 -07:00
Andrew Deason
1da664f520 salvager: Do not AskOnline nonexistent volumes
If singleVolumeNumber is not in our volume summary list, then the
singleVolumeNumber volume does not exist. So, don't try to bring it
back online. Still do try to make sure we don't have the volume
checked out, though, so issue an AskDelete, so ensure that it's not
checked out and that the fileserver does not think it exists.

Change AskDelete so we don't care if we tried to delete a volume that
the fileserver thinks already doesn't exist. Change the FSYNC_VOL_DONE
handler so it does not complain about already-deleted volumes.

Reviewed-on: http://gerrit.openafs.org/4295
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit f2c1f2ee48663d00701e7cee52b99151e36b9534)

Change-Id: I708c173ae6cbd3f40cc09f6fc3229a6f038baf3f
Reviewed-on: http://gerrit.openafs.org/5760
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:33:29 -07:00
Andrew Deason
d35b9f6453 Fix ihandle.c indents
ihandle.c had some blocks that were not indented. Indent them.

Reviewed-on: http://gerrit.openafs.org/4273
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 9ac85bb2fd91baa4c3077d091f395f57e933018a)

Change-Id: I83604d19759a183fa10989596734a405515ac19c
Reviewed-on: http://gerrit.openafs.org/5759
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:32:49 -07:00
Andrew Deason
5823fda443 vol: Handle large volume IDs in VLockFile
VLockVolumeByIdNB currently cannot handle volume IDs larger than
2^31-1. Fix this by using struct flock64, F_SETLKW64, and F_SETLK64 in
the VLockFile functions where possible.

Thanks to Simon Wilkinson for pointing out F_SETLK64.

Reviewed-on: http://gerrit.openafs.org/4198
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 85edec7105dd653ed1d8046b69b8262281e97bba)

Change-Id: Iee09a8bc4a0aabbd12fe156940fa61d6947642e8
Reviewed-on: http://gerrit.openafs.org/5758
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:32:36 -07:00
Andrew Deason
0a61a148e6 vol-salvage: Fix AskOnline error message
Reviewed-on: http://gerrit.openafs.org/4116
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 22365ab37ac823b6734f4fc0ad79f10b6ee14390)

Change-Id: I7cf852d563b72c40b183b728143b59e8e4b8da7b
Reviewed-on: http://gerrit.openafs.org/5757
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:32:22 -07:00
Andrew Deason
83e29ccc89 Give a default reason in *sync-debug
If no -reason is given for fssync-debug calls, we currently just
transmit garbage to the fileserver or salvageserver. Instead, give a
default (the *_WHATEVER constant), so we do something consistent.

Reviewed-on: http://gerrit.openafs.org/4115
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 7f31a11d110085ae528d4555d34744c0832008b0)

Change-Id: I27aefea0e891444e006e5d4b5ed43ed9cd492242
Reviewed-on: http://gerrit.openafs.org/5756
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:30:55 -07:00
Andrew Deason
7ffd4a867a ConvertROtoRW: Use old copyDate for creationDate
When we convert an RO volume to an RW, currently we just copy the
copyDate and creationDate from the RO metadata into the RW. But the
copyDate and creationDate fields have different meanings for RW and RO
volumes: for ROs, the creationDate is merely the last time the data
was updated from the RW during a release operation.

So, if the copyDate is older than the creationDate, use the copyDate
as the new RW creationDate instead. This will probably not match the
creationDate of the original RW, but it will be closer to it, and it
will more accurately represent the conceptual "created time" of the
new RW.

Doing this can avoid forcing an unnecessary full dump on a subsequent
release of the resultant RW volume, since the creationDate is more
accurate.

Reviewed-on: http://gerrit.openafs.org/3891
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit f47487db051ba6b51ae12daf7edc09ecfd3c38cd)

Change-Id: I54516a20ebb87d9c482cbc4840e0d236e7c54f8a
Reviewed-on: http://gerrit.openafs.org/5755
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:30:39 -07:00
Andrew Deason
f6168a849c libafs: Set tvcp->callback before BulkStatus
When we call InlineBulkStatus or BulkStatus, we currently do not touch
tvcp->callback for any of the vcaches before making the call. This can
cause us to not notice an InitCallBackState issued by the fileserver
before the BulkStatus call returns, since the InitCallBackState
handler looks at tvcp->callback to determine what vcaches to clear
callbacks for. In turn, this can cause us to think we have a callback
agreement with the fileserver on one of the BulkStatus'd files, when
the fileserver does not actually have such a callback agreement.

So, set tvcp->callback to the server we are contacting, so if we get
an InitCallBackState call from that fileserver, the CBulkFetching
state will be cleared, and we will correctly discard the callback
information for that vcache.

Reviewed-on: http://gerrit.openafs.org/2548
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 37817796c4890683a7e41ed0f3a2fa6a53e1edc7)

Change-Id: I85c89eff061af799a7d8f612bee9b2f182312e6f
Reviewed-on: http://gerrit.openafs.org/5754
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:30:04 -07:00
Andrew Deason
651dd6d25e ubik: Log a message when we replay the trans log
It can be helpful to know that an interrupted transaction was replayed
on startup, and this should be rare. So log a message when that
happens, indicating what db version we replayed to.

Reviewed-on: http://gerrit.openafs.org/3385
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit d29550a438a60dd918938f484c7b75e25478abd9)

Change-Id: Ic3c8ec68febae8b61b6d04ef4d063178dffe8d0e
Reviewed-on: http://gerrit.openafs.org/5753
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:29:55 -07:00
Andrew Deason
237e8e1990 ubik: Replay the transaction log label correctly
Commit eec0d94f519b3e27f255b9b7a637df043951424e fixed the transaction
replay log code to correctly identify valid transaction logs on
little-endian systems, but missed ntohl'ing the database label read in
a LOGEND opcode. Fix that, so the database is labelled correctly when
replayed from a transaction log.

And while we're here, actually pass a struct ubik_version* to
adbase->setlabel, to make it a little more clear what's happening.

Reviewed-on: http://gerrit.openafs.org/3384
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 1e8598b334b4354a3998b1e5fe189f3f33957048)

Change-Id: I832eff8641c339a103170f50238bbb669412bda0
Reviewed-on: http://gerrit.openafs.org/5752
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:29:24 -07:00
Andrew Deason
4c80871a16 ubik: Record the last write tid in writeTidCounter
ubik is currently tracking writeTidCounter for write transactions
separately from regular transactions (assigned from tidCounter).
Specifically, tidCounter is incremented twice for each transaction,
but writeTidCounter is incremented twice only for write transactions.
As a result, writeTidCounter and tidCounter tend to drift far apart.

This is a problem, since the tid for DISK_* calls uses the transaction
id of the current transaction (based on tidCounter), and VOTE_Beacon
uses writeTidCounter for its transaction id. So, in effect, the tid in
VOTE_Beacon is completely bogus and unrelated to the transaction id of
the actual current write transaction. This can cause valid write
transactions to become invalidated when tidCounter becomes negative,
since VOTE_Beacon will send a positive tid, and if there is a current
in-flight write transaction with a negative tid, SVOTE_Beacon will
deem the transactions inequal and will abort the write transaction.

So instead, record the transaction id counter for the last write
transaction in writeTidCounter. This way, when we call VOTE_Beacon, we
will use the correct transaction id counter for the current write
transaction, and SVOTE_Beacon on the remote site will not invalidate
the transaction.

Reviewed-on: http://gerrit.openafs.org/2647
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit a0cc81c0894193db11860d8fe40380c7198741a9)

Change-Id: Iabff9bd68db088c30c7e44ad71b7d34bcfaaf207
Reviewed-on: http://gerrit.openafs.org/5751
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:28:05 -07:00
Andrew Deason
b9830adf8b DAFS: raise vhashsize limit
Raise the maximum specifiable vhashsize to 28 (from 14). Specifying a
vhashsize over 14 can be reasonable if you expect to have a few
million volumes on a fileserver.

Reviewed-on: http://gerrit.openafs.org/2725
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit b2d067a913d3c2e5dbfe756b7752ade308f967c1)

Change-Id: I2e2d7ca4986af417c3298c3cfff8f087d795bc53
Reviewed-on: http://gerrit.openafs.org/5750
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:27:55 -07:00
Andrew Deason
0548587958 DAFS: Do not ignore out-of-range -vhashsize
If the specified -vhashsize is out of the 6-14 range, do not just
ignore it. Instead, note the error and quit.

Reviewed-on: http://gerrit.openafs.org/2649
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 575bdaf56e8f5503513bec113653fbbe525ae228)

Change-Id: Ie0ebfcf1b5c88816ef58eab109fb05de4c7fad1e
Reviewed-on: http://gerrit.openafs.org/5749
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:26:59 -07:00
Simon Wilkinson
ffa86554af Tidy up uio_t meaning
On IRIX, uio_t is typedef'd to "struct uio".
On Darwin, uio_t is typedef'd to "struct uio *".

Reduce the confusion by just not using "uio_t" in places where it
isn't being defined for us, and avoiding it completely in cross-platform
code.

Reviewed-on: http://gerrit.openafs.org/4748
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit ca465e432d67b067fc3854781b8702aaff577cc7)

Change-Id: Id37d11e72d196f5008e9843d4f04c492a4017e72
Reviewed-on: http://gerrit.openafs.org/5779
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:25:50 -07:00
Andrew Deason
66d1ace117 SOLARIS: Perform daemon syscalls as kernel threads
Add AFS_SUN5_ENV to the list of platforms where AFS_DAEMONOP_ENV is
defined. Implement the necessary functionality so we spawn kernel
threads when a daemon syscall is called. Remove the rxk_Listener
wrapper, since it will be called in a separate thread via the
afs_DaemonOp interface.

Reviewed-on: http://gerrit.openafs.org/4189
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit e261238470ed28ee7c1068d914de171b34033e09)

Change-Id: I6b3eb829dec3ec4338dbe8f2363ced2bdcd7dc9a
Reviewed-on: http://gerrit.openafs.org/5778
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:24:16 -07:00
Andrew Deason
942ec73fa6 libafs: Consolidate afs_DaemonOp code
Create the AFS_DAEMONOP_ENV define to simplify the logic of when we
perform afs_DaemonOp-y code paths. Also create the daemonOp_common
function, to perform common pre-fork operations that are common
between platforms.

Reviewed-on: http://gerrit.openafs.org/4188
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 6143bb27d20380e689346b4e66c077e5d4cd6061)

Change-Id: I8878b5b55871c1974b19c2af64636ea536841bff
Reviewed-on: http://gerrit.openafs.org/5777
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:23:42 -07:00
Andrew Deason
f618b050d4 libafs: Indent afs_call.c ifdef maze
Reviewed-on: http://gerrit.openafs.org/4187
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 05241a59a1ce88d2f25d75127124971c55e1f677)

Change-Id: I3ef7aeb5e111f9365a10d86a440ad31c4fe76902
Reviewed-on: http://gerrit.openafs.org/5776
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-11-01 19:23:27 -07:00
Ben Kaduk
ab9bdaf110 FBSD: deal with kernel API rename
Upstream decided to rename the kernel functions that implement
syscalls to have a sys_prefix (including afs3_syscall!).
We use a couple of them, so we need to conditionalize accordingly.
Unfortunately, __FreeBSD_version was not bumped with the change,
so we use something close to it and hope it's close enough.

Reviewed-on: http://gerrit.openafs.org/5572
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 4a1d319177ea0e58c9046c3c173bb7d2877d1bc3)

Change-Id: I01d943398a3c15009f72f668720bfe6bc8eac63d
Reviewed-on: http://gerrit.openafs.org/5639
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-29 15:31:09 -07:00
Derrick Brashear
793f219e7b ukernel: get an ip address even when dns and hosts suck
gethostname plus gethostbyname being useless make things fun

make things less fun

(cherry picked from commit 6f59c71988d75f76750c46adb11cda7e9189d5f3)

Change-Id: Id7d9181b2d87f7a87a08991b96da664f4297604b
Reviewed-on: http://gerrit.openafs.org/5726
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:58:15 -07:00
Jacob Thebault-Spieker
2d817e49d6 allow cloning of any volume to any volume with same parent ID
remove checks to disallow cloning of ro volumes to rw volumes,
which allows cloning of any volume within the same parent ID
grouping, including allowing destruction of newer version of the
volumes.

Reviewed-on: http://gerrit.openafs.org/5049
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 83c41c69411ece7ac1dd0a7b15d4ee9746edcf23)

Change-Id: Idc2575538811d278fb65be46cfc0cd4d24d90f5d
Reviewed-on: http://gerrit.openafs.org/5725
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:57:35 -07:00
Jacob Thebault-Spieker
da78610b26 remove check for disallowing clones of backup or ro volumes
removes the if-statement ensuring that the volume being cloned is
not a backup volume, nor a read-only volume. This allows clones
from any type of volume to a given volume. Parent volume meta-data
is maintained, only the cloneId value changes.

Reviewed-on: http://gerrit.openafs.org/5046
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 4e1a65ba7edec519acc67f0dcf2237a0f26e92aa)

Change-Id: Ibda6a8a12804fc35890c99ada6d711e25a50a6c8
Reviewed-on: http://gerrit.openafs.org/5724
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:56:49 -07:00
Michael Meffie
068f201c3f bozo: test program update
Add -file option to test program to simulate program crashes.

Reviewed-on: http://gerrit.openafs.org/5533
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit e7302bcc9c4aa6f1e6a1ae8e5b498bcb0540aac9)

Change-Id: I0cf394c881da7c01f75a7926700f896a905e8172
Reviewed-on: http://gerrit.openafs.org/5723
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:56:27 -07:00
Andrew Deason
465e613b5d DAFS: Remove VOL_SALVAGE_INVALIDATE_HEADER
Currently VRequestSalvage_r takes a flag,
VOL_SALVAGE_INVALIDATE_HEADER, which causes the header for the
specified volume to be freed (via FreeVolumeHeader). This is almost
never safe to do, since there may be other users of the specified
volume that can be accessing the volume header at the same time.

There is also no reason to invalidate the header at the time of the
VRequestSalvage_r call, since the header must be invalidated when we
detach the volume (other utilities may change header information). So,
if there are any problems in the future because we do not invalidate
the header at the time of VRequestSalvage_r, it is the fault of the
detachment/offlining logic.

So, remove VOL_SALVAGE_INVALIDATE_HEADER and all of its users. Take
this opportunity to correctly document the VRequestSalvage_r headers
in the VRequestSalvage_r comment, as it was previously missing the
VOL_SALVAGE_NO_OFFLINE flag.

Reviewed-on: http://gerrit.openafs.org/5319
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 4552dc552687267fce3c7a6a9c7f4a1e9395c8e5)

Change-Id: Ib991ecefea2115a3c4308ed3c261af7433c9b858
Reviewed-on: http://gerrit.openafs.org/5722
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:55:54 -07:00
Michael Meffie
850ca0e144 DAFS: fssync online requires a partition name argument
fssync-debug online silently fails when run without a partition name.
Check for the required partition name on the server side and the client
side.  Report errors back to the client when the server side fails to
pre-attach the volume.

Reviewed-on: http://gerrit.openafs.org/5615
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit d171a5e059566cc99c5dd980039dd56233f91a67)

Change-Id: Id8776c71cd1712ecb779c76565cfb9e685e54a19
Reviewed-on: http://gerrit.openafs.org/5721
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:55:43 -07:00
Andrew Deason
080e4a736b volser: Remove ExtractVolId
volser was using its own function to extract a volume ID from a
filename string, and was using atol to do so. The ato* family of
functions can have problems with larger volume IDs, not to mention a
lack of error checking, so don't use it. Since we already have the
function VolumeNumber in the vol package to do the very same thing,
just use that instead.

Reviewed-on: http://gerrit.openafs.org/5594
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 87f969f82d12c8200ede3fd30a151e09ab0bf6ad)

Change-Id: I4f047c4141493e151db0a6b5ec21bee3af35e040
Reviewed-on: http://gerrit.openafs.org/5720
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:55:31 -07:00
Andrew Deason
bcccac5ccb viced: Check for HOSTDELETED in stillborn check
h_FindClient_r checks the connection rock for a client object twice.
First it sees if we already have a client object, and if we don't, we
effectively create one (or find a suitable one). Then we check again,
to see if someone else set the rock while we were creating a client
structure.

Currently, the first check checks if client->host->hostFlags has
HOSTDELETED set, but the second check does not. So, if the host
associated with the client has been deleted by someone else, currently
we will unnecessarily log a "stillborn client" message, and we will
continue to use the deleted host. If the host continues to be held by
someone, we will run into the same situation repeatedly on future
requests until all of the host references go away.

To fix this, also ignore HOSTDELETED clients when performing the
stillborn race check.

Reviewed-on: http://gerrit.openafs.org/5614
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit b5a153fb75bb6642490e9856dc6212244a590301)

Change-Id: I3fb0b01c2ef14cd077cd4db9476ed6e90c7d3c2a
Reviewed-on: http://gerrit.openafs.org/5719
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:55:15 -07:00
Andrew Deason
b33db8c7de vos offline: Bring volume back online for -busy
vos offline is supposed to bring a volume back online from "busy"
status before exiting, as volumes should not be in "busy" status for
extended periods of time. This was being enforced by required that
-sleep be specified; however, -sleep only results in the volume being
brought back online if a non-zero sleep time was specified. So, make
sure the volume is brought back online if -busy was specified.

Reviewed-on: http://gerrit.openafs.org/5620
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 8c7202fb9ea9cf5e5c888000ec84fd9b7478068d)

Change-Id: I64aa6f297b787ca666959ff4f35d17aced6e41a7
Reviewed-on: http://gerrit.openafs.org/5718
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:55:06 -07:00
Derrick Brashear
1bee1365cd bypasscache: allow arbitrary sized iovecs
instead of binding outselves to PAGE_SIZE, just fill any size

Reviewed-on: http://gerrit.openafs.org/5658
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 4b817cbb520872e69b01e5675f9037d8948d0ade)

Change-Id: I350f4e7e0936be50960c80d115a44afe750a48fa
Reviewed-on: http://gerrit.openafs.org/5717
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:54:55 -07:00
Derrick Brashear
d7ed88fce4 bypasscache: do errors correctly
do set errors when we bomb out early
do not unlock and return early when we happen to do a correct zero
length read
do set errors the kernel can deal with if we're feeding a page routine

Reviewed-on: http://gerrit.openafs.org/5554
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 28a159b2bfff7ad450dce612601a0286d4f91df5)

Change-Id: I4f2e1b50a3c0856a08281e0ffbfaa7cbb71db2c4
Reviewed-on: http://gerrit.openafs.org/5716
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:54:06 -07:00
Simon Wilkinson
5391ef0732 rpm: Turn on debugging
Now that we build with a blank CFLAGS line, we need to make sure and
actually turn on debugging in the build system, so that our debuginfo
files are vaguely useful

Reviewed-on: http://gerrit.openafs.org/5662
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 1de23d1fe5d64c8f5e8f24579c0926fabdaace92)

Change-Id: I9384b9632efb5e7a9054b49c6b6f2f4cfc9c9376
Reviewed-on: http://gerrit.openafs.org/5715
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:53:43 -07:00
Simon Wilkinson
660b35f511 rx: ackall handling
If we ACKALL a stream, then we're sending a hard ACK for all of the
packets in the stream. We shouldn't send that hard ACK, and then a
load of soft ACKs for packets that don't actually exist.

Reviewed-on: http://gerrit.openafs.org/5604
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit a9924ba433f81bfbfc2c0e726f2be06d460e4d56)

Change-Id: Ibba1d5448f2ba9315b6b9bc3e893d16d8bcdbc3c
Reviewed-on: http://gerrit.openafs.org/5714
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:53:31 -07:00
Andrew Deason
f26f90640e LINUX: Fix afs_linux_pag_to_groups signature
"new" is a struct group_info**, not a struct group_info*

Reviewed-on: http://gerrit.openafs.org/5648
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 6cb6bcc208a0ebb57325522ed764c7bf4bf6104e)

Change-Id: I6a3f31284f74af8cdeeeecd920bec26f955dc0da
Reviewed-on: http://gerrit.openafs.org/5713
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:53:01 -07:00
Andrew Deason
d6c5cde26e LINUX: Revert group changes on keyring failure
On Linux kernels that support keyrings, when we setpag we try to add
the PAG to the session keyring and to the supplemental group list.
Currently, if we fail to add the PAG to the keyring (which may happen
due to key quotas, or possibly other reasons), we return failure but
the group list is still modified with the new PAG in it.

Therefore, if the keyring-based approach fails, the new PAG may still
be in use, but there are no keyring keys associated with that PAG, so
the PAG may never get destroyed. This can cause a large number of PAGs
to accumulate over time, causing performance problems.

So, change this so that, in the event that keyring installation fails,
we revert the group list back to what it was before we touched it.
Also mark all unixusers with the new PAG as expired, in case one got
created during processing. Thus, the new PAG never gets used.

Reviewed-on: http://gerrit.openafs.org/5238
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit ee2fbffb04bb8b5098354646e262afa90c1b6f59)

Change-Id: Ie954ce2b1bc502cc1abe2fa1eecc18b31d066038
Reviewed-on: http://gerrit.openafs.org/5712
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:52:39 -07:00
Andrew Deason
d1711efd73 viced: Do not swallow errors on StoreData recovery
When we encounter any error in the StoreData fetch/store loop, we
reset the disk usage to ensure it remains correct, even in the face of
unexpected errors. However, when we do so, we use the errorCode from
VAdjustDiskUsage as our return value; if it is 0, we return success,
ignoring the error that got us in this code path in the first place.

Instead, keep track of a temporary errorCode for the disk usage
adjustment, and do not override our return value if there was no error
in the disk usage numbers.

Reviewed-on: http://gerrit.openafs.org/5645
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit dd831c09602f1ef16cc7dece84aeff638cce7272)

Change-Id: I154e6cbc96ee4e32bee2da77441547c1dce8b42c
Reviewed-on: http://gerrit.openafs.org/5711
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:52:26 -07:00
Simon Wilkinson
a4333a6bc1 linux: makesrpm should cope with releases with letters
don't just deal with numbered releases.

Reviewed-on: http://gerrit.openafs.org/5602
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 69f54d474827548375c0bd39a87ac7ec376b6d9b)

Change-Id: I3e433fe4b7f1b2dbedcfc70215ba114de16900c4
Reviewed-on: http://gerrit.openafs.org/5710
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-26 15:52:16 -07:00