Commit Graph

10792 Commits

Author SHA1 Message Date
Jeffrey Altman
5acf8b7f98 Windows: QuerySecurity deny access to SACL
The SACL requires System Access Level.  Requests for SACL by
end user applications must be denied.  Permit access to Owner,
Group, DACL and Label but not SACL.

This change permits executables to be initiated from drive
letter mappings.

Change-Id: Ibf847261f0c36dc7b6175b0536657161158cd44f
Reviewed-on: http://gerrit.openafs.org/8483
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-23 07:48:49 -08:00
Jeffrey Altman
6d37315a9c Windows: Fix Redir link counting
Each object in AFS has a link count which tracks the number of
directory entries that refer to the FileId.  In the redirector
there is one ObjectInformationCB per FileId and one AFSDirectoryCB
for each directory entry.  When a directory entry is deleted perhaps
by delete on close it is important to ensure that the matching
ObjectInformationCB is not deleted unless the Link count drops to 0.

Change-Id: I2c7906d5881f93ed60697d40a0ea462f4567d443
Reviewed-on: http://gerrit.openafs.org/8480
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-23 07:48:20 -08:00
Jeffrey Altman
f436fe03c8 Windows: buf_CleanLocked protect against NULL bp->userp
The cm_buf_t.userp field should never be NULL if the CM_BUF_DIRTY
flag is set but apparently it sometimes is.  cm_BufWrite() requires
that the userp parameter be non-NULL.  Otherwise, an assertion fails
and afsd_service.exe panics.  If bp->userp is NULL, use cm_rootUserp.
The worst that will happen is the write will fail due to an access
denied error.

Change-Id: I6cc650dcffe2b0fb50ac2ce91b74e8afbdfc40ca
Reviewed-on: http://gerrit.openafs.org/8475
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-23 07:46:22 -08:00
Jeffrey Altman
887cff5b0f Windows: do not adjust deleted scache LRU ordering
Instead of moving deleted scache objects so that they are next
in line to be recycled, do not move them at all.  Making them
next to be recycled results in the CM_SCACHEFLAG_DELETED flag
value being lost.

Change-Id: I3839053066cca304454e445b2f4e4abea6e08dda
Reviewed-on: http://gerrit.openafs.org/8474
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-23 07:45:59 -08:00
Jeffrey Altman
c99797eadc Windows: buf_CleanLocked validate cm_scache_t
If the cm_scache_t object is not passed in by the caller ensure
that the cm_scache_t has a valid callback.  If the cm_scache_t
has the CM_SCACHEFLAG_DELETED flag set, clear the dirty flag on
the cm_buf_t and do not bother contacting the file server.

Change-Id: If85be550b59765f64aadea4e1882af9430cebcb4
Reviewed-on: http://gerrit.openafs.org/8473
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-23 07:45:45 -08:00
Jeffrey Altman
f03247ddd7 Windows: buf_SetDirty add assertion
the userp parameter must never be NULL.

Change-Id: Id785ac417bc869f708990f0bfe53809e3e5c71e5
Reviewed-on: http://gerrit.openafs.org/8472
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-23 07:45:18 -08:00
Simon Wilkinson
b28c51d594 opr: Don't confuse isLast and isEnd
opr_queue_IsEnd's implementation was incorrect - it would return
true when the element was the last item in the list, not when it
was the end of the list (equal to the head record)

Correct the implementation of isEnd, and add an implementation for
isLast.

This fixes a bug in RX, wher we would never notice that the last
packet in the transmit queue was acknowledged, because the loop that
iterates over the queue uses isEnd to detect when its work is done.

Change-Id: I8966e05c479c18d025bb5cc4cf77514ce002be95
Reviewed-on: http://gerrit.openafs.org/8493
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-23 06:18:31 -08:00
Andrew Deason
ad4e634051 afs: Do not skip flushing pages for dv-0 files
If the dv for a file is 0, we know the file is empty. Currently we
skip flushing pages for such files, presumably the idea being there is
no data in the file, so there should be no pages to flush.

However, Linux seems to keep empty pages around for empty files. So, a
future read can result in the application reading a page full of
zeroes, unless we flush the page here. While this has only been found
to happen on Linux 2.6.22 and later (and distribution-specific
backports, like RHEL 2.6.18-128), other platforms could in theory also
choose to do this. It would be difficult to find out when another
platform started to behave like this, so just remove this skip for
everyone so we never have to deal with this again.

Replace this code with a comment with a quick explanation, in case
anyone tries to add a similar optimization here in the future.

Thanks to Richard Brittain.

Change-Id: I68c51bb7612a98a5c75112bb8f4bb1edd949fda1
Reviewed-on: http://gerrit.openafs.org/8465
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-20 01:57:10 -08:00
Marc Dionne
aeb2763b74 Linux 3.7: key instantiate API change
Adapt to the new parameters for the instantiate key operation.

Change-Id: I25dea3489b68cad662e962a4973ee98ec7228cd3
Reviewed-on: http://gerrit.openafs.org/8470
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Hans-Werner Paulsen <hans@MPA-Garching.MPG.DE>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-19 04:22:11 -08:00
Marc Dionne
007ec3e25e Linux 3.7: remove use of param.h and ioctl.h
Header files param.h and ioctl.h have moved as part of the userspace
API restructuring of header files.  Nothing in those files is
currently needed by the source, so just drop the includes.

Change-Id: Icbbf7038ca1bf23edbde42aaf48f5108626d0040
Reviewed-on: http://gerrit.openafs.org/8469
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-19 04:22:01 -08:00
Marc Dionne
2bafb2f99d Linux: change test for new putname API
Replace the existing test with a more robust one that checks for
the existence of the new filename structure.  Since older kernels
are expected to fail this test, we'll get the correct result even
if there is unrelated failure, for instance a missing/different
header file.

Change-Id: Ie50abce37580eab803e9b07e636a1538f4a91a81
Reviewed-on: http://gerrit.openafs.org/8466
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-19 04:21:52 -08:00
Jeffrey Altman
e1d149c925 Windows: Hold ProcessTreeLock across AFSValidateProcessEntry
AFSValidateProcessEntry() is called from AFSProcessCreate() which
holds the ProcessTree.TreeLock exclusive across the call and from
AFSCreate() and AFSRetrieveAuthGroup() where it is not held at all.

Add a parameter to AFSValidateProcessEntry() that indicates whether
or not the ProcessTree.TreeLock is held.  If it is held, it must be
held exclusive.  If it is not held, the lock must be acquired within
AFSValidateProcessEntry() and it must be held for the entire lifetime
of the pParentProcessCB reference.  Failure to hold the TreeLock
for the lifetime of the reference permits a race with AFSProcessDestroy()
that can result in the parent ProcessCB being destroyed while its
Resource is held.

Change-Id: I7cf0dff6bd541b0588a060d677a8e3d724858b96
Reviewed-on: http://gerrit.openafs.org/8455
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-15 08:45:43 -08:00
Jeffrey Altman
f56c01d313 Windows: Do not reset cm_buf.offset on error
When an error occurs the cm_buf_t is not removed from the
hash tables.  Since the scacheHashTable hash is built from
the fid and the offset it is not safe to reset the offset field.
Resetting the offset field results in an assertion failure
during buffer recycling.

Change-Id: Id33ec048f8ecfd7f715feafadfa4ea618cdbac0d
Reviewed-on: http://gerrit.openafs.org/8452
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-13 20:12:43 -08:00
Jeffrey Altman
91f43fb6f7 include roken.h in yacc parsers
Change-Id: Ic6f2dba3ee5bbfdb2794fd9ecc8e1ab2eb3de828
Reviewed-on: http://gerrit.openafs.org/8450
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-13 20:12:31 -08:00
Andrew Deason
3081a2cff2 afs: Add some comments on GetValidDSlot panics
A couple of call sites for afs_GetValidDSlot currently panic if an
error is returned, but no explanation is given. Add a few comments
helping explain why there is a panic there, instead of graceful error
handling.

Change-Id: Ic1c9808c427fe7524ea7dc1b7dbab8e9ac665b91
Reviewed-on: http://gerrit.openafs.org/8407
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-13 10:39:48 -08:00
Andrew Deason
866a9fbbdd afs_FreeDiscardedDCache: Avoid assert on error
Currently afs_FreeDiscardedDCache will assert if it cannot read in any
discarded dcache entry to free. Return an error instead of asserting,
so the caller can figure out what to do about the error.

Adjust the callers to handle the error, or panic.
afs_MaybeFreeDiscardedDCache still just panics anyway, as making it
handle the error gracefully is beyond the scope of this commit, and is
work for another day.

This changes afs_FreeDiscardedDCache to return an int.

Change-Id: Id1e77af18461c9804b655c6f91ac90038621a394
Reviewed-on: http://gerrit.openafs.org/8406
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-13 10:39:26 -08:00
Andrew Deason
e02185547e afs: Handle afs_AllocDCache errors
Do not panic if afs_AllocDCache encounters an error and returns NULL.
Instead, go into the normal retry loop that occurs if we couldn't free
up any more free/discard dcache entries.

Change-Id: Ia165e0b5f5ef37e05942c795955d75f26e4ea7d3
Reviewed-on: http://gerrit.openafs.org/8405
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-13 10:39:07 -08:00
Andrew Deason
64ee7b32f1 afs_AllocDCache: return NULL instead of panic
Currently afs_AllocDCache will panic if we cannot get a valid dcache
from the free/discard lists. Instead, return NULL, so the caller can
decide how to handle the error.

Currently the caller will just panic anyway, but that will be
addressed in a future commit.

Change-Id: Iafb539bbda9ef20907ef575699185f111ca39c2b
Reviewed-on: http://gerrit.openafs.org/8377
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-13 10:38:20 -08:00
Andrew Deason
3369391797 afs: Traverse discard/free dslot list if errors
Currently, when we pull a dslot off of the discard or free list, we
just try to get the first entry from the list, and panic if we cannot
get it. Instead, traverse through the whole list, trying to find an
entry we can successfully get. This introduces the helper function
afs_GetDSlotFromList to do this traversal.

This does not yet address the case where we cannot get any entry on
the relevant list.

Change-Id: Iedbcffcbeb5dda61fde8e1d526e793f68c3200b3
Reviewed-on: http://gerrit.openafs.org/8376
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-13 10:38:01 -08:00
Andrew Deason
f74a0a7bbb afs: Handle easy GetValidDSlot errors
Many callers of GetValidDSlot currently assume they will always get
back a valid dcache, and will panic on getting NULL. However, for many
of these callers, handling the NULL case is quite easy, since the
failure to get a dcache can just result in an error directly, or
obtaining the dcache is best-effort or just an optimization.

This commit just handles the "easy" cases; some other callers require
more complex handling.

Change-Id: I622908de7004ba4cb18ccb26bda0e75b879f65ca
Reviewed-on: http://gerrit.openafs.org/8375
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-13 10:37:45 -08:00
Andrew Deason
20b0c65a28 afs: Never use GetNewDSlot after init
Currently there are two ways to get a dcache via a slot number:
afs_GetNewDSot and afs_GetValidDSlot. afs_GetValidDSlot assumes that
the given slot number refers to a dcache entry that is valid on disk;
with afs_GetNewDSlot, the given slot may not be valid, and if it is
not, an empty 'template' dcache is returned.

afs_GetNewDSlot is useful for initializing cache files, since if a
given dcache slot exists on disk and contains valid data, we use the
dcache like normal. If it does not already exist or does not contain
valid data, we fill in the missing data after afs_GetNewDSlot returns.

However, for all other uses, afs_GetNewDSlot is incorrect, and causes
various serious problems. After we have initialized our dcache
entries, any attempt to read a dcache by slot number should succeed,
since the number of dcache entries never changes after we are started,
and we initialized all of them during client startup.

Some code outside of afs_InitCacheFile was still using
afs_GetNewDSlot; code that reads in a dslot from the free or discard
list. In these cases, if there is any error reading the dcache slot
from disk, we will be given a dcache that has some of its fields not
filled in properly. Notably, we assume that the entry is not on the
global hash table (we set tdc->f.fid.Fid.Volume to 0), and the
tdc->f.inode field is not initialized at all, leaving it set to
whatever was in memory for that tdc before we tried to read the slot
from disk.

This can cause cache corruption, since tdc->f.inode can point to the
inoder for a different existing cache file, so writing to that dcache
modifies the data for another cached file.

To avoid this, modify the non-afs_InitCacheFile callers of
afs_GetNewDSlot to avoid afs_GetNewDSlot. Since these callers read
from the free/discard list, the contents of the dcache entries are not
valid (the cell, volume, dv, etc are not valid), though they must
exist on disk (we have a valid inode number for them). So, create a
new function, afs_GetUnusedDSlot, to get a dcache that must exist on
disk, but does not represent any valid data. Use this for callers that
must get a dslot from the free/discard list.

Add some comments to try and help explain what is going on.

Change-Id: I5b1b7ef4886102a9e145320932b2fd650b5c6f2f
Reviewed-on: http://gerrit.openafs.org/8370
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2012-11-13 10:37:31 -08:00
Jeffrey Altman
fb5eccb2fe Windows: SYMSTORE the entire WINNT/afsrdr tree
The tools directories need to be imported into the symstore
one directory at a time.

The "build.exe" output files afsredir.sys, afsredirlib.sys and
afsrdfsprovider.dll must be imported from within the kernel
build environment script.

Change-Id: Ida7d84deecfb1ec4f508c5c40fc5576e2cb7b3e4
Reviewed-on: http://gerrit.openafs.org/8445
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-12 15:57:47 -08:00
Jeffrey Altman
152e3c0423 Windows: Add AFSRedir binaries to Symbol Store
Change-Id: I1b4f2d5fcd4243e9a8a931a223bced33631206b0
Reviewed-on: http://gerrit.openafs.org/8441
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-12 13:04:39 -08:00
Jeffrey Altman
e15a612252 Windows: torture should not reference roken.h
Do not include roken.h in torture tests.  The torture test
should not be linked to afsroken.dll.

Change-Id: I14d67c2e2f9980906854e0ab72c040eb9437a931
Reviewed-on: http://gerrit.openafs.org/8431
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-12 10:58:28 -08:00
Jeffrey Altman
0bef3159d3 afsio: process windows file paths consistently
Windows file paths can use either '\' or '/' as a path
separator.  libafscp on the other hand requires '/' and argv[0]
will always use '\'.

Introduce a new function ConvertAFSPath() which converts the
input path to '/' and converts \\afs to /afs.  A future commit
should access the registry and make use of the NetbiosName and
MountRoot values to perform the conversion correctly.

Change-Id: I14f5f45234ec4beab58751783a25206b3e7eff45
Reviewed-on: http://gerrit.openafs.org/8430
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-12 10:50:46 -08:00
Jeffrey Altman
be50ea11fe libafscp: Windows TellMeAboutYourSelf response
The address list and uuid are computed in init_afs_cb().  There
is no need for special Windows processing within TellMeAboutYourSelf.

Change-Id: Ica4d2edb69ac9000713b016996a2c58e8b65ee9c
Reviewed-on: http://gerrit.openafs.org/8429
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-12 10:50:34 -08:00
Jeffrey Altman
cdad65170d libafscp: build as pthreaded for windows
Change-Id: Iaa9515e572178f44deb670a83daba358c2d4dc74
Reviewed-on: http://gerrit.openafs.org/8428
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-12 10:50:23 -08:00
Jeffrey Altman
81db8d9764 Windows: afsrpc.dll MAKEDEBUGCALL
Enable debug calls from the pthreaded RX library.

Change-Id: Ie5e98d4408a3eb259e7f5f298f0776931f0d488a
Reviewed-on: http://gerrit.openafs.org/8427
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-12 10:50:12 -08:00
Andrew Deason
692c300e37 afs: Pass rx connection to print_internet_address
Make print_internet_address take an rx_connection, so it can print out
more information based on rx info. Currently it does not use the
connection; this commit is just for adding the connection to the
interface, and adjusting all of the callers to cope. There should be
no behavior change.

Change-Id: I410ffe43b7b6fc4d5c82666529c9263969820185
Reviewed-on: http://gerrit.openafs.org/8409
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2012-11-12 10:34:00 -08:00
Michael Meffie
bcb077a00f fix stale volume info from vos examine (non-dafs)
A volume examine on a non-dafs volume server/fileserver can show old
information, including old volume update time, for up to about 20
minutes. The non-dafs volume server reads the volume information
from the volume headers, which are updated by the fileserver only
periodically to avoid excessive i/o.

Before dafs, when the volume server performed a volume examine, the
volume server would send a fssync command to the fileserver with the
request FSYNC_NEEDVOLUME and mode V_READONLY. The fileserver writes
the current memory contents to disk on this fssync command. The
volume server would then attach the volume, reading the current
volume data.

The dafs volume/fileserver avoids this extra i/o by using a new set
of fssync commands to retrieve the volume information from the
fileserver. However, the non-dafs volume server does not use the new
fssync commands and reads the volume headers from disk.

Revert the volume attachment processing for the non-dafs volume
server to request the volume with the V_READONLY mode. This causes
the fileserver to update the volume headers, allowing the volume
server to read the up to date volume header data.

Sadly, this adds another dafs ifdef to the already twisty maze of
passages that all look alike.

This changes the volserver to use the V_READONLY attachment mode
only for the case of getting a single volume, as that what was
done in 1.4.x.

Change-Id: Ibee25bfcfb087e73ccbc17e181a99da49a7751ae
Reviewed-on: http://gerrit.openafs.org/8327
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-12 10:31:56 -08:00
Michael Meffie
0eaa0d1baa vol: allow non-dafs volume utils to attach with V_READONLY again
Allow non-fileserver, non-dafs, programs to attach volumes with the
V_READONLY mode again. This was lost during the code changes for
dafs.

The caller sends a fssync request to the fileserver, which updates the
on-disk contents of the volume headers, before the caller reads the
volume headers, allowing the caller to have the most recent info about
the volume. The fileserver still has the volume in use.

Later in the attachment process, the inUse check is skipped for the case
of a non-fileserver process which is attaching the volume using the
V_READONLY mode, otherwise the attachment would incorrectly mark the
volume as needing to be salvaged.

Note: The mode checks in VMustCheckOutVolume() are correct. We must
checkout the volume when attaching with the V_READONLY mode. This
fix updates the VShouldCheckInUse(), in which an additional
exception was added to cover the case for V_READONLY mode from a non-
fileserver process.

Note: A check is added in the dafs version of attach to avoid overwriting the
inUse field when a volume utility is attaching a volume in V_READONLY mode.
Currently, V_READONLY is not used by dafs, but this was done to avoid future
errors.

Change-Id: I09d3af1e74087d0627399392e662e5075d41cdeb
Reviewed-on: http://gerrit.openafs.org/8339
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2012-11-12 10:31:42 -08:00
Hans-Werner Paulsen
d2d3c51a7d fileserver: check value of -cb argument
The value of the -cb argument for the fileserver was not checked correctly.
The fileserver refused to start for any number of callbacks.

Change-Id: I25fe9d81ba20d286f36999a554c94fda4ef7fb2f
Reviewed-on: http://gerrit.openafs.org/8420
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-09 06:26:40 -08:00
Jeffrey Altman
15670c1ae9 Windows: use hKUserMap to read afslogon username
hkTemp is not the correct registry handle.  Use hkUserMap

Change-Id: I44776b6dd46bb0ecac0c729bf80ed9261ddf7a67
Reviewed-on: http://gerrit.openafs.org/8412
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-08 20:41:28 -08:00
Jeffrey Altman
6f79eb3659 Windows: Prevent SMB unitialized variable access
smb_ReceiveNTTranCreate would make use of 'fidp' before it was
allocated.

Change-Id: Ib4a7262ba09f15049f1855535250638c2e5d17a4
Reviewed-on: http://gerrit.openafs.org/8411
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-08 20:41:05 -08:00
Jeffrey Altman
c01e552b85 Windows: Treat invalid AFSFetchStatus as VBUSY
Modify cm_Analyze() to accept an AFSFetchStatus parameter which
when set is verified for validity.  If the status info is invalid,
then consider the response equivalent to VBUSY and attempt to
query an alternate file server (if any.)   Log the invalid status
info to the Windows Application Event Log as a Warning.

When cm_Analyze() is processing the response of an RPC that returns
multiple AFSFetchStatus structures, pass in the one that corresponds
with the source object.

Change-Id: I84be22f332ff6fd7bc9620347f958538a3412380
Reviewed-on: http://gerrit.openafs.org/8404
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-08 20:40:27 -08:00
Jeffrey Altman
d87a9adeb6 Windows: cm_IsStatusValid
Break out validity checking for AFSFetchStatus responses into
a new function.

Change-Id: I15d2ed12ed2d9ca9a24d6f717243d823db22d30c
Reviewed-on: http://gerrit.openafs.org/8403
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-08 20:38:50 -08:00
Jeffrey Altman
45f0a9ba7f Windows: cm_MergeStatus now returns an error code
cm_MergeStatus() can fail if the AFSFetchStatus InterfaceVersion
field does not have the value 0x1 as that is the only version that
is defined by the protocol.  The return code will be CM_ERROR_INVAL.
cm_MergeStatus() returns 0 on success.

Update all of the call sites.

Change-Id: Iddf56f68dfa26b0f11744b905a70d7d39ad853d1
Reviewed-on: http://gerrit.openafs.org/8402
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-08 20:38:23 -08:00
Andrew Deason
48b6047889 afs: Make last_error always useful
Currently we record last_error as the last getuerror() we got when
failing to read in a slot in UFSGetDSlot. For kernels that do not have
getuerror(), this variable is currently useless, and we do not record
anywhere what the last error received was (besides logging it via
afs_warn).

So, for non-uerror, just record what 'code' we got, so we at least
have something.

Change-Id: Iede39bbeee48ea48f380b788f2968886a831a918
Reviewed-on: http://gerrit.openafs.org/8369
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2012-11-08 04:00:44 -08:00
Andrew Deason
b5d9e29e89 afs: Log slot for GetDSlot read errors
When we log that a disk read error occurred during GetDSlot, log which
slot we were trying to read for convenience.

Change-Id: I35ffa94ff31cee735e85542ed9697b5f14180226
Reviewed-on: http://gerrit.openafs.org/8368
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2012-11-08 04:00:37 -08:00
Andrew Deason
bbea7b07f3 rx: Fix non-TSFPQ rxi_FreePackets
Actually count the number of packets we're given, so we don't bail out
early because num_pkts is 0. Without this, we effectively do not free
most packets for non-pthreads Rx, so e.g. the unix kernel module will
leak memory quite quickly and be very slow.

This was introduced by 170dbb3c.

Change-Id: Id781e37170683c422b40079fdda018be1caddaf3
Reviewed-on: http://gerrit.openafs.org/8401
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-08 03:59:42 -08:00
Jeffrey Altman
30ee8b645e Windows: RDR_CleanupFileEntry protect lock release
Prevent lock release of scp->rw when not held.

Change-Id: I9ed3ca464a7881cd365ebe3560d5a6da22e21c86
Reviewed-on: http://gerrit.openafs.org/8372
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-07 16:45:28 -08:00
Jeffrey Altman
8c7846f4e1 Windows: call MIDL_user_allocate instead of calloc
In the RPC service routines do not call calloc() directly.
All memory will be deallocated by a call to MIDL_user_free()
so use MIDL_user_allocate() to perform the allocation.

Modify MIDL_user_allocate() to call calloc() instead of malloc()
to ensure that the memory is initialized to NUL bytes.

Change-Id: I4d458bb5d8888c63040f213550d04f481e98175b
Reviewed-on: http://gerrit.openafs.org/8365
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-07 16:45:15 -08:00
Jeffrey Altman
40964dd39d Windows: no more _wcsdup; use wcsdup
_wcsdup is not mapped by roken.h.  Use wcsdup which is.

Change-Id: I0f6bb3f5465c74ad52f992892fcbc9837c276c0c
Reviewed-on: http://gerrit.openafs.org/8364
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-07 16:45:02 -08:00
Ben Kaduk
f749f17fe1 Catch up to FreeBSD non-MPSAFE deorbit
All filesystems must have their own locking now.
We have been MPSAFE for quite some time, but the preprocessor macro
"MPSAFE" has been removed and we must catch up in order to compile.

The MNTK_MPSAFE macro has not yet been removed, but it is toothless
now, so we can preemptively stop using it.

Change-Id: I9d9090fd1afc020670a0cf874baacf483fd34915
Reviewed-on: http://gerrit.openafs.org/8366
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-07 11:14:06 -08:00
Simon Wilkinson
586e9cd24e opr: Add Windows stuff for dict.c/h
The NTMakefile changes were omitted from the patch which added
opr/dict.h for Unix. Add them here.

Change-Id: I240b40116aed83dcf232a1d741d0ef7b442bf6f7
Reviewed-on: http://gerrit.openafs.org/8358
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-03 10:09:59 -07:00
Jeffrey Altman
ba718cba92 Windows: Use MountRoot for Absolute Symlinks
Replace the absolute symlink processing in AFSLocateName().
Implement AFSIsAbsoluteAFSName() to test whether or not the
path is in fact an absolute /afs path by comparing the input
string to the registry MountRoot value which specifies the
case sensitive root path for all absolute symlinks stored
in the AFS cell.

If a symlink target path begins with a directory separator
and is not an absolute afs path name, return an error.

Construct the substitution string using the target path
without the MountRoot prefix.

Add functionality to AFSRedir.sys to read the MountRoot
from the registry and pass it on to AFSRedirLib.sys.

Change-Id: Ie1df24da1e6de257c73dc34c80a75288bad47d29
Reviewed-on: http://gerrit.openafs.org/8353
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-11-02 06:51:33 -07:00
Derrick Brashear
7fe30bd28e configure: check for poll()
if we have code which uses HAVE_POLL, check for poll().

Change-Id: I1baf61541b243f82b3acca112db2cbbca813182b
Reviewed-on: http://gerrit.openafs.org/8357
Reviewed-by: Chaskiel Grundman <cg2v@andrew.cmu.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-01 20:24:52 -07:00
Simon Wilkinson
5be3cdc3f3 opr: Add dictionary implementation
Add a simple implementation of a dictionary/hash structure based around
opr queues and the jhash hashing function.

Change-Id: I4ae5cafcef377b05c8caa7c455737a992b1d36cd
Reviewed-on: http://gerrit.openafs.org/8355
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-01 12:18:01 -07:00
Simon Wilkinson
07372cf7e7 opr: Add opr_jhash_int2 function
Add a function to jhash that can be used to hash a pair of unsigned
integers (or other stuff that can cast to them) without having to build
up an array.

Provide a couple of tests for the new function

Change-Id: I594848f64316fb459eff565933691f560512ca79
Reviewed-on: http://gerrit.openafs.org/8354
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2012-11-01 11:30:20 -07:00
Simon Wilkinson
dce5e012fe tests: Fix fallout from cleanup change
The change to cleanup temporary files after tests
(0c3670914a) broke all attempts
to run the tests using libwrap, as it would cause libwrap to run
the binary named "MAKECHECK=1"

Move the variable defintion before the libwrap invocation to fix this.

Change-Id: I330267c9b53483abccf43d60a7dc8f8d973c3959
Reviewed-on: http://gerrit.openafs.org/8356
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: Derrick Brashear <shadow@your-file-system.com>
2012-11-01 10:51:53 -07:00