In cm_Analyze() replace the token error retry logic for miscellaneous
rx errors and simply mark the server down. The most common error
that will be seen in this category is RX_INVALID_OPERATION which would
be received if the Rx service id or security class is not recognized
by the peer. This could happen if an AuriStor server is replaced by
an AFS3 server or if a packet is reflected.
A side effect of this change is that V* and CM_ERROR_* errors will
once again be retried. This will permit proper failover to occur.
Change-Id: I77e6325eb05643ea6df1fc0bc877bd4ef496c974
Reviewed-on: http://gerrit.openafs.org/11920
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
If a VLDB query attempt occurs when there is no current cell db server
list then the VLDB query won't actually occur but the last query time
would be set. This prevents a query from taking place again on the volume
for 60 seconds. If the volume in question is the root.cell volume then
the redirector will be forced to return device not ready for the share
(aka \\afs\cell).
Check for a failure of cm_UpdateCell() and only set the last update time
for the volume if there was success or if the VLDB responded with volume
unknown.
Change-Id: Ic87d871feac3f2ea3d3db377854efa9dc9db3c00
Reviewed-on: http://gerrit.openafs.org/11919
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
cm_ApplyDir() failed to maintain the synchronization state while the
GetBuffer() operation proceeded.
Change-Id: I616622e9aebbdb20a325826032991e5d5c5d9e24
Reviewed-on: http://gerrit.openafs.org/11918
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
cm_CheckNTDelete() forgot to call cm_SyncDone() in one of the error
paths. Fixup the call pattern and do not forget to call cm_SyncDone().
Change-Id: I9274b65c5a5f22ca71e0b10f860d57d7e567a56c
Reviewed-on: http://gerrit.openafs.org/11917
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
When adding a connection verify that the server name and the share name
are valid. If not return ERROR_BAD_NETWORK_NAME.
When getting connection information, if a pre-existing connection does
not exist and either the server name or the share name do not verify
return ERROR_BAD_NETWORK_NAME and not ERROR_INVALID_PARAMETER.
Change-Id: Ib40a6b56318793d1c1b351ba895736beb616585d
Reviewed-on: http://gerrit.openafs.org/11916
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
When the redirector ioctl fails in NPGetResourceInformation() return the
actual error to the caller. Do not hide all errors as WN_BAD_NETNAME.
Change-Id: Ie02ca5331aa34aef4476c99045048871c6c25de0
Reviewed-on: http://gerrit.openafs.org/11915
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Ensure that RemoteName paths have at least two characters before
attempting to access character [1].
Change-Id: I75487056686dccf2bf57b22e7c99e9d8210eaaf3
Reviewed-on: http://gerrit.openafs.org/11914
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
The uniFullName.MaximumLength in AFSParseName() is not properly
modified and can end up being extended beyond the actual memory
allocation due to a missing decrement.
Change-Id: I070ee33acd32849d05bbc83c6e7cfaf55e6a0997
Reviewed-on: http://gerrit.openafs.org/11913
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
The authentication id for the process will always be obtained in kernel
so no longer try to fetch it in userland.
Change-Id: I8d35af1349e137b8a3d7d8299b16e443710c6482
Reviewed-on: http://gerrit.openafs.org/11911
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
When processing network provider requests in afsredirlib.sys always
obtain the auth id using the SYSTEM worker thread. Do not trust
the values provided by userland.
Change-Id: I9786b0c836cf967074035a7595c38c8700cb7589
Reviewed-on: http://gerrit.openafs.org/11910
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
When PsReferenceImpersonationToken(), PsReferencePrimaryToken(), and
SeQueryInformationToken() are called in the kernel from a user process
thread the restrictions on the userland process still apply. Since we do
not want to be restricted we must obtain the token and query the token
information from a SYSTEM thread.
This change restructures the AFSGetAuthenticationId() process to queue a
synchronous task to the worker thread.
This should address the problem that has been seen during system boot when
the Group Policy Service attempts to query, remove or create a drive
letter mapping.
Change-Id: Ib8772e185aa1e4e52979ec847bbc18a9878bcaca
Reviewed-on: http://gerrit.openafs.org/11909
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Modify AFSRetrieveFileAttributes() to handle the case of a ParentPathName
with a Length == 0. In such a case the introduction of a path separator
would result in the construction of an absolute path when a relative path
is required.
Change-Id: I2e633b22992b0aee914927a451bb146fc57110e8
Reviewed-on: http://gerrit.openafs.org/11889
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
AFSRetrieveParentPath() when presented with a relative path that has no
parent will walk off the front of the FullFileName buffer. Add checks to
ensure that Length never becomes less than zero.
Change-Id: I7d619dc569d6c002b1d236a9340921414c51647f
Reviewed-on: http://gerrit.openafs.org/11888
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
AFSGetConnectionInfo() is called to respond to NPGetResourceInformation
and NPGetConnectionPerformance WNet API requests. The former permits
the requestor to provide a path containing components that are not
processed by the file system represented by the called network provider.
As such partial matches are permitted BUT they must consist of full
components. In other words, \\afs\sh is not a valid partial match for
\\afs\share but \\afs\share is a valid partial match for \\afs\share\dir.
This change adds validation checks to enforce full component comparisons.
It also cleans up some of the associated comparisons and trace output.
Change-Id: Ia736030f554f9770b201227c4dce26d7d45fe0d2
Reviewed-on: http://gerrit.openafs.org/11887
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
In NetrShareGetInfo() when registry api calls fail do not leak the
error codes to the caller. Instead, set the error to CM_ERROR_NOSUCHPATH
so that NERR_NetNameNotFound can be returned.
Change-Id: I2c8f12573ca604385176ebb18d92ff2f7023a27e
Reviewed-on: http://gerrit.openafs.org/11924
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
When processing the NetrShareGetInfo() pipe service rpc do not
allocate memory for the return buffer is the path cannot be found.
Change-Id: I782df44de4d6b7a4664234ae0f8295294b889469
Reviewed-on: http://gerrit.openafs.org/11923
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Remove the conditionals which hide the md5 digest calculation for inode
numbers on non-linux platforms. This feature was originally added to
support sites running on linux, but is generally useful and the
implementation is not specific to linux.
Change-Id: I7f406f9492780c1893dc1a2892db253b05036120
Reviewed-on: http://gerrit.openafs.org/11854
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
In the interest of fostering a friendly, welcoming environment
for contributors, institute a code of conduct for the project.
Adapted from the Contributor Covenant.
LICENSE MIT
Change-Id: I4eb3b8a84981ef04f02e7d60ec46873305888147
Reviewed-on: http://gerrit.openafs.org/11987
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jonathan A. Kollasch <jakllsch@kollasch.net>
Reviewed-by: Thomas L. Kula <kula@tproa.net>
Reviewed-by: Nathaniel Filardo <nwfilardo@gmail.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Commit 2e9dcc069904aaa434787eec53c6f9821911cbab reinstated negative
dentry caching, but introduced an oops when fakestat is in use. Be sure
the GLOCK is held when looking up the parent vcache dv when the parent
is a mount point and fakestat is in use, since the calls to do the
lookup require the GLOCK to be held.
Change-Id: I6c47fbf53280400bf40271b1ff2837bd7c6dc69e
Reviewed-on: http://gerrit.openafs.org/12019
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Supergroup information is explicitly present in -members
Change-Id: I25527c093858bc0b029417cbf2bb07717c50bb32
Reviewed-on: http://gerrit.openafs.org/11681
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Move the code to create the initial "localcell" configuration and the
code to get the rx bind address out of main and into separate
functions.
Replace the global array of host addresses used to get the rx bind
address with a local variable.
Replace the call to rx_getAllAddr() with rx_getAllAddrMaskMtu(). The
former is not safe to call before rx_InitHost().
Initialize the cell info structure to zeros when creating the initial
"localcell" configuration.
Change-Id: I756aef86018d0cdd499afa58fdea99a7ac0d99df
Reviewed-on: http://gerrit.openafs.org/11690
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Add the softsig functions to the exported symbols list.
Change-Id: I9378297ae035111459e597ae211fe832e93b63e3
Reviewed-on: http://gerrit.openafs.org/11999
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Now that we are using a real hash function, larger hash tables
will be more useful.
The vcache hash tables are statically sized, and this increase will
add about a megabyte to the kernel module's memory footprint.
Update the algorithm used to dynamically size the dcache hash tables,
keeping the old behavior for small numbers of dcaches, but growing
the hash table's size to keep the average chain length near two
for a range of dcache numbers. Cap the dcache hash tables at 32k
entries to avoid excessive resource usage.
This involves code from opr, namely opr/ffs.h, which is acceptable
in the kernel module because that header is a standalone header
like jhash.h, with no dependencies on the system.
Change-Id: I7cdb3e993b1c2ad177a46ecc06bfa2be52e619e5
Reviewed-on: http://gerrit.openafs.org/11679
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Instead of silently failing, return EIO from readdir when the
cache manager is unable to allocate a buffer in afs_newslot,
(afs: all buffers locked).
Change-Id: I3d5a5d73ce78db216400cab45a651fd8a49ea0c3
Reviewed-on: http://gerrit.openafs.org/1001
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
One of the changes in commit 652f3bd9cb7a5d7833a760ba50ef7c2c67214bba
effectively disabled negative caching for dentries, by always
invalidating a negative dentry in afs_linux_dentry_revalidate. This
was because various temporary errors could result in ENOENT errors
being returned to afs_lookup, which created incorrect negative dentry
cache entries.
These incorrect ENOENT errors were rectified in change
Ib01e4309e44b532f843d53c8de2eae613e397bf6 . So, negative dentry cache
entries should work now, so remove the code to unconditionally
invalidate these negative entries.
Change-Id: Ic027147fd1f733beaa0fafbbabfa8c09f5656d34
Reviewed-on: http://gerrit.openafs.org/11789
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Prior to this commit, the output C files from compile_et would
emit #includes of <afsconfig.h> and <afs/param.h>. These files
are not installed, and are only available in an OpenAFS build tree.
The output C files also emit #includes of <afs/error_table.h>, which
is an installed file, and is therefore expected to be available on
a system with OpenAFS installed. Removing the first two headers will
allow OpenAFS's compile_et binary to be used to compile error tables
which are not part of OpenAFS, on systems where OpenAFS is installed.
The inclusion of afsconfig.h was added in commit
972a4072827fb2ec680354d5adebc2c5cca06939 to ensure that it was included
prior to afs/param.h; however, the inclusion of afs/param.h in
compile_et.c stems from the original IBM import and seems of minimal
value. The only changes needed to build without param.h are to use
int instead of afs_int32 in a couple places (int is 32 bits on
all platforms currently supported) and to include <sys/types.h>
for size_t.
Change-Id: I1ee969eec92b139d265a7494e13ddfc69c05f238
Reviewed-on: http://gerrit.openafs.org/11708
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Switch the four dcache and vcache hash tables to use the jenkins
hash from opr.
This requires making DCHash into a full-weight function in order
to properly hash all three inputs; convert all four symbols to
full functions for consistency. Just pull in <opr/jhash.h> via
afs.h so all consumers (e.g., of VCSIZE) can use it without
modification.
This is the first use of src/opr/ in src/afs/ (outside UKERNEL),
but it is permissible because opr/jhash.h is a standalone
header and there are no C files needed for its implementation which
would require anything from the system.
Change-Id: Ic7f31e7dc548ff2cf13ac087a9e4bbb2b874e03a
Reviewed-on: http://gerrit.openafs.org/11673
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
We don't actually do anything that matters if lastPacketSizeSeq
is set and lastPacketSize is zero, so zero both when we're cleaning
up.
lastPacketSize and lastPacketSizeSeq are set together in
rxi_SendPacket (and rxi_SendPacketList), when we are sending a packet
larger than the current estimate of the peer's maxPacketSize.
The two fields are checked together during ack processing, but
rxi_CheckCall() only checks lastPacketSize, ignoring lastPacketSizeSeq.
Change-Id: I4e52bed0900b5551859200699f114f5d5a61581c
Reviewed-on: http://gerrit.openafs.org/11633
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Add a manual page for the KeyFileExt file.
Add cross-references from all places which currently reference
KeyFile(5), and update their body text accordingly.
Change-Id: Iab56847fcb59dda0c8a344a626ddb0ff35b98b26
Reviewed-on: http://gerrit.openafs.org/11770
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Use the full path when renaming the BosLog file to BosLog.old and when
checking whether the BosLog file can be opened, otherwise the rename
will fail (and go unnoticed), and the initial BosLog check opens a
handle to a file in the wrong directory.
Create the server directories, including the logs directory, before
forking and log file initialization.
Change-Id: I3733d64335f348190572f6278086b634641f2754
Reviewed-on: http://gerrit.openafs.org/11685
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Fix the default value for the -pidfiles argument. The pidfiles
should be stored in the local state directory, not the server
configuration directory when using modern paths.
Fixes commit bdf86d245fd55c5c7ac7ea81e3d6b6bafdbe1783.
Change-Id: Ie338b0071c6ea6ee44b376d231d12b85571de6ae
Reviewed-on: http://gerrit.openafs.org/11732
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Resolves this warning:
admin_tools.c: In function ‘SetFields’:
admin_tools.c:611:30: warning: pointer targets in passing argument 2 of ‘ktime_DateToInt32’ differ in signedness [-Wpointer-sign]
code = ktime_DateToInt32(s, &expiration);
^
In file included from /home/anders/wd/openafs/include/afs/afsutil.h:84:0,
from admin_tools.c:39:
/home/anders/wd/openafs/include/afs/afsutil_prototypes.h:101:18: note: expected ‘afs_int32 *’ but argument is of type ‘afs_uint32 *’
extern afs_int32 ktime_DateToInt32(char *adate, afs_int32 * aint32);
^
Change-Id: Id24e7a6cd1ab2291c0c05d3835f4ad7fddfec8d7
Reviewed-on: http://gerrit.openafs.org/11956
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Prefer KeyFileExt to KeyFile ~everywhere. Make the main documentation
assume a modern cell with KeyFileExt and rxkad-k5, moving the old
rxkad and KeyFile documentation to a new section,
HISTORICAL COMPATIBILITY.
Note that kaserver is deprecated.
Do not mention the Update Server, which is also disrecommended for
new installations.
Add a copyright statement for the new content.
Change-Id: Idcb4940615a00189b655538a9a190cc35153cc89
Reviewed-on: http://gerrit.openafs.org/11769
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
As long as we avoid using directory aliases when crossing
a mount point (at the volume root), we should always get
to a given non root directory with the same dentry.
The mechanism added by commit de381aa0 ("Linux: Make dir
dentry aliases act like symlinks") is therefore only really
necessary for a volume root.
With kernel 4.2 it is not possible to tweak the "total link
count", resulting in ELOOP errors when looking up a path
with 40 or more directories that are being looked up for
the first time. With this change, only mountpoints will
count against the limit.
Change-Id: Id0e5a51d579eee51ecb8d7fb575a7a30740ea70e
Reviewed-on: http://gerrit.openafs.org/11945
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
In order to start the softsig test helper properly,
the full path of this program is necessary.
FIXES 132246
Change-Id: I4e9ff1e62a0b82078338eeaf0d4368ac1b35dccc
Reviewed-on: http://gerrit.openafs.org/11977
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Resolves this warning:
keys-t.c: In function ‘copy’:
keys-t.c:63:6: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(out, block, len);
^
Change-Id: If2427f2658b428091ffba3d11643ad95f193a67d
Reviewed-on: http://gerrit.openafs.org/11957
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
In afs_CheckRootVolume, the local rootVolumeName array needs to
be large enough to hold the contents of the global
afs_rootVolumeName string, which is 64 characters long. Fix our
local array to be the same length by using a new defined constant
MAXROOTVOLNAMELEN.
Caught by coverity (#985758)
Change-Id: I4c926b94efb40d7107e2d7160ade0ba8b381004e
Reviewed-on: http://gerrit.openafs.org/9348
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
with the command "vos dump -clone" use the volumename of the cloned volume
instead of the fixed string "dump-clone-temp". This volumename is recorded
in the DumpHeader and VolumeHeader of the dump file.
Change-Id: I38ef846f043680c8f13dce263581a61bbd7ef7dd
Reviewed-on: http://gerrit.openafs.org/11670
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
When the timeval structure uses 64-bit values for sec and usec,
64 extra bits need to be skipped in the input for every time value
that is parsed. There's a remaining assumption in this part of the
code that the time values received from the server are 32-bits, but
after decoding they will always have the local size which may well
be 64-bits.
Change-Id: Iaf52df8f9da1146807dddc1c44a9e52e83654d9c
Reviewed-on: http://gerrit.openafs.org/10592
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
While here, bump the default size from 256 to 1024.
Change-Id: Ife95f14009764785a18556289d5dfe5e7a96b477
Reviewed-on: http://gerrit.openafs.org/11667
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Remove the vnodeHashOffset field, as the Jenkins hash will get
a uniform-enough distribution without this extra help. Per-volume
unique hashing is retained by using the volume ID as the initial
value input to the Jenkins hash.
While here, increase the vnode hash table size from 256 to 2048.
Change-Id: I353dfc8178f13f4e9adcd03a331adf2a7c64a1a9
Reviewed-on: http://gerrit.openafs.org/11666
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Put them closer to the code they are describing.
Change-Id: Iaf7137eae2bf4464f26d98b0c3e0e9040f19c321
Reviewed-on: http://gerrit.openafs.org/11665
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
At present the hashid is set to the same value as the volume ID
(i.e., V_id(vp) a.k.a. vp->header->diskstuff.id), but we should
not leak across the abstraction barrier without cause.
Change-Id: I6a727e60c34bdc938f4ae2e815c7513802a4dbc9
Reviewed-on: http://gerrit.openafs.org/11664
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
A few different places in the tree currently invoke compile_et in a
few different ways. These three general styles all appear:
${COMPILE_ET_H} -p ${srcdir} foo
${COMPILE_ET_H} -p ${srcdir} foo.et
${COMPILE_ET_H} ${srcdir}/foo.et
Of these, the first is the correct way to invoke compile_et in a
Makefile. The other two can fail during at least some objdir builds.
Take this example of the second style of invocation:
afs_trace.h: afs_trace.et
${COMPILE_ET_H} -v 2 -p ${srcdir} afs_trace.et
During an objdir build, the compile_et command will get expanded like
so, due to VPATH expansion:
$top_objdir/src/comerr/compile_et -emit h -v 2 \
-p $top_srcdir/src/afs \
$top_srcdir/src/afs/afs_trace.et
The compile_et command concatenates the -p prefix with the actual
filename provided, so the file it tries to open is:
$top_srcdir/src/afs/$top_srcdir/src/afs/afs_trace.et
For non-objdir builds this doesn't happen, since $srcdir is just '.',
and afs_trace.et gets expanded to just afs_trace.et (or possibly
./afs_trace.et). This is also not a problem for objdir builds that are
specified as a relative path and are 'adjacent' to the srcdir. For
example, if we ran '../openafs-1.6.10pre1/configure --options', our
$top_srcdir is just '../openafs-1.6.10pre1', with some magic to
expand '..' to the correct number of levels. So in the above example,
the compile_et invocation gets expanded to:
/path/to/objdir/src/comerr/compile_et -emit h -v 2 \
-p ../../../openafs-1.6.10pre1/src/afs \
../../../openafs-1.6.10pre1/src/afs/afs_trace.et
And compile_et then tries to open the path
../../../openafs-1.6.10pre1/src/afs/../../../openafs-1.6.10pre1/src/afs/afs_trace.et
which collapses to just
../../../openafs-1.6.10pre1/src/afs/afs_trace.et, which is the correct
file.
However, if the $srcdir is specified as an absolute path, or if the
number of '..'s is wrong, this doesn't work. It is perhaps easiest to
explain why by just using another example. For an absolute path, the
invoked command is:
/path/to/objdir/src/comerr/compile_et -emit h -v 2 \
-p /path/to/openafs-1.6.10pre1/src/afs \
/path/to/openafs-1.6.10pre1/src/afs/afs_trace.et
And compile_et tries to open
/path/to/openafs-1.6.10pre1/src/afs/path/to/openafs-1.6.10pre1/src/afs/afs_trace.et,
which obviously does not exist. This results in a build failure like:
/path/to/openafs-1.6.10pre1/src/afs/path/to/openafs-1.6.10pre1/src/afs/afs_trace.et: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target `afs_trace.msf'
For a non-working relative objdir, we may invoke a command like this:
/path/to/objdir/src/comerr/compile_et -emit h -v 2 \
-p ../../../../openafs-1.6.10pre1/src/afs \
../../../../openafs-1.6.10pre1/src/afs/afs_trace.et
And compile_et tries to open
../../../../openafs-1.6.10pre1/src/afs/../../../../openafs-1.6.10pre1/src/afs/afs_trace.et,
which is ../../../../../openafs-1.6.10pre1/src/afs/afs_trace.et, which
(probably) doesn't exist, since it goes one too many levels up.
To avoid this, we can just prevent the filename argument to compile_et
from undergoing VPATH expansion. compile_et never opens the given path
directly if -p is given, so it's not really a file path and so should
not be altered by VPATH.
compile_et will add a trailing .et to the filename if it doesn't have
one, so we can avoid the VPATH expansion by just leaving out the
trailing .et. We could also avoid the VPATH expansion by specifying
something like './afs_trace.et', but it is perhaps more clear to not
say the explicit filename, since we're not really specifying a path to
a file.
Just leaving out the -p option, as in this style of compile_et
invocation:
dumpscan_errs.h: ${srcdir}/dumpscan_errs.et
$(COMPILE_ET_H) ${srcdir}/dumpscan_errs.et
also fails for objdir builds. This is because, without the -p option,
compile_et defaults to '.' as the prefix. If the srcdir is
/path/to/openafs-1.6.10pre1, then this will expand to:
/path/to/objdir/src/comerr/compile_et -emit h \
.//path/to/openafs-1.6.10pre1/src/tools/dumpscan/dumpscan_errs.et
which will fail, since that path to dumpscan_errs.et does not exist.
So to fix this, make all compile_et invocations follow this style:
${COMPILE_ET_H} -p ${srcdir} foo
Many other invocations of compile_et in the tree are already like
this, so this commit just changes the others to match.
Change-Id: Ied12e07a1cc6e115d4a10cd7a6c97aae9ce7f5f9
Reviewed-on: http://gerrit.openafs.org/11391
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
A few of the linux autoconf tests generate -Wunused-but-set-variable
warnings, unless the test is run with -Wno-unused-but-set-variable.
Since we run these tests with -Werror, this can cause the tests to
incorrectly fail if they are not run with
-Wno-unused-but-set-variable.
The Linux kernel build process normally does run with that option, but
due to some other (possibly buggy) behavior, sometimes these configure
tests do not run with that option. So, make our tests work without
generating that warning, so we will work in more cases.
Reorganize a few of these tests so we are setting a field in a global
structure, instead of a function-local one. Make the test function
names and style little more consistent while we are here, but do not
make the global structure 'static', in case the compiler recognizes we
are setting fields for a structure that cannot be used by anything.
In particular, the "revalidate takes nameidata" test had been wrongly
succeeding, but that didn't usually matter because of how the feature
tests are ordered in the code. It does matter in the case when the
"revalidate takes unsigned" check also gets a wrong result, which
can cause kernel BUGs, which should be fixed by these changes.
See:
<http://lists.openafs.org/pipermail/openafs-devel/2014-January/019727.html>
<http://thread.gmane.org/gmane.comp.file-systems.openafs.devel/11361>
Change-Id: Ic29c4fc61da17633d8d1af81949b3917beb58cf6
Reviewed-on: http://gerrit.openafs.org/10706
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
We log that the length of the response was wrong, so we're dropping
the connection. Log what the actual and expected lengths were, at
least, so we can maybe get a little bit of useful information from
this message.
Change-Id: I499d43c7625712b507698d908feb21477b789563
Reviewed-on: http://gerrit.openafs.org/10829
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
When looking up a file, the ENOENT error code is supposed to be used
if we know that the target filename does not exist. That is, the
situation is a user or application error; they specified a filename
that was not previously created.
Currently, though, we use ENOENT for a variety of different
situations, such as:
- After successfully looking up a directory entry, we fail to
afs_GetDCache or afs_GetVCache on the FID for that entry.
- We encounter an invalid mount point, in certain code paths.
In each of these situations, an ENOENT error code is incorrect, since
the target filename does indeed exist and these situations may be
caused by network or administrative errors. An ENOENT error implies
that the user may be able to then create the target filename, which is
not true most of the time in the above situations.
In addition, on LINUX we return a negative dcache entry when we
encounter an ENOENT error on lookup. This means that if any of the
above scenarios occur, Linux would cache the fact that that directory
entry did not exist, and return ENOENT for future lookups. This was
worked around in one of the changes in commit
652f3bd9cb7a5d7833a760ba50ef7c2c67214bba to always invalidate such
negative dentries, but at the cost of performance (since this caused
negative lookups to never be cached).
To avoid all of these issues, just don't use ENOENT in these
situations. For simple non-disconnected afs_GetDCache or afs_GetVCache
errors, return EIO, since we have encountered an error that is
internal to AFS (either the underlying data is inconsistent, or we
have a network error, or something else). In disconnected operation,
return ENETDOWN like in other disconnected code paths, since often the
root cause is due to us not having network access. When a bad
mountpoint is encountered, return ENODEV, since that is what we use
elsewhere in the code when encountering a bad mountpoint.
It is also noteworthy that this changes removes the translation of
VNOVNODE into ENOENT, since a nonexistent vnode is not the same as a
nonexistent filename, as described above. Some code paths have special
behavior for this situation (ignoring the error in some cases where it
does not matter). These code paths should be okay with this change,
since all of them examine error codes that have not been translated
through afs_CheckCode.
Some useless references to ENOENT were also removed in
src/afs/LINUX*/osi_misc.c. These did not result in incorrect behavior,
but removing them makes searching for bad ENOENT references easier.
Change-Id: Ib01e4309e44b532f843d53c8de2eae613e397bf6
Reviewed-on: http://gerrit.openafs.org/11788
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Currently, numerous places in the code treat the 'mvid' field in
struct vcache as a few different things:
- If the vcache is a mountpoint, mvid points to the fid of the root
dir of the target volume.
- If the vcache is a volume root dir, mvid points to the fid of the
parent dir for the mountpoint.
- If the vcache is a sillyrenamed file, mvid points to a string,
which is the name the vcache was renamed to.
Despite these three things being very different (and one of them is a
completely different type than the others), everywhere in the code
just accesses mvid as 'avc->mvid'. This can make it very confusing as
to what the field actually means at any particular part of the code,
and makes it very difficult to search the code for places that use
mvid in any one of these specific ways.
So, to aid in code clarity, make mvid into a union, with the following
members:
- target_root: For the "mountpoint" case.
- parent: For the "root dir" case.
- silly_name: For the "sillyrename" case.
This should have no effect on code behavior, but just makes the code a
bit clearer.
Change-Id: I45391bb7a99d6f8e35c44873b677d157ea681900
Reviewed-on: http://gerrit.openafs.org/11748
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>