If DirEnumEntry is NULL, then on failure of AFSEvaluateTargetByName()
a NULL pointer will be dereferenced prior to function return.
Change-Id: I6d0d646e667c4b805abcddce1af49b81037ae51d
Reviewed-on: http://gerrit.openafs.org/11422
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
When reading the result of a pioctl fails with ERROR_NOT_SUPPORTED
this must be translated to an EINVAL errno.
Change-Id: I3db03f80b8a0da5d7e4931dc5673c7010d580d8d
Reviewed-on: http://gerrit.openafs.org/11417
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Only Read and Query privileges are required to enumerate the registry
keys, do not request write privileges for an enumeration.
Change-Id: Ifc9acb4203db71b6e94bf5a21ca5aa104d94d35b
Reviewed-on: http://gerrit.openafs.org/11416
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Syncing lock operations with callback fetching is unnecessary because
local lock state is not tracked via callbacks. More importantly it
risks blocking the cm_LockDaemon thread which needs to be able to
renew locks without obstruction.
Change-Id: Iabe9bb33fef599c4eb0e876e222587ee3e2fdb49
Reviewed-on: http://gerrit.openafs.org/11415
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
If cm_SyncOp was called, then cm_SyncOpDone must be called.
By goto out of the loop, the cm_SyncOpDone call was skipped.
Change-Id: I20105ec8708c19eecbf215258ada0779cd705f73
Reviewed-on: http://gerrit.openafs.org/11414
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
For the Rx connections used for probing VL and FILE servers set a
hard dead timeout and not a connection timeout. A connection timeout
will not terminate the call as long as the lastReceiveTime continues
to be updated by ping packets. The hard dead timeout will cause the
connection to fail when the 10 second limit expires.
Change-Id: I371dcd95fc0ff822a205cf903fa6218e80a2b042
Reviewed-on: http://gerrit.openafs.org/11401
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
When updating the Freelance directory do not notify the redirector
of individual objects to invalidate since that can leaad to race
conditions. Send whole volume invalidations since that is what is
required in any case.
Change-Id: I22a963907ebbb3da3178750670a2897603463cfe
Reviewed-on: http://gerrit.openafs.org/11400
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
The AFSRetrieveFileAttributes() function is used to acquire the
attributes for an AFS symlink. The result is either returned directly
to the application or used internally to determine the attributes
to be exposed by reparse points.
If the evaluated symlink crosses a DFS Link the redirector cannot
return the request to IO Manager to evaluate the target. Instead
the redirector must handle the request internally and attempt to
read the attributes of the target object.
Change-Id: If14df8dc41e13fd59b524fdb575c46abab1dfc2f
Reviewed-on: http://gerrit.openafs.org/11399
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
As with Mount Points and Symlinks, when AFSLocateName() is called to
process a CreateFile with Open_Reparse_Point enabled, DFS Link processing
must be disabled only for the last component in the path. Failure to
do so results in the AFS Redirector succeeding IRP_MJ_CREATE calls that
should be given back to the IO Manager so the path can be evaluated by
another file system.
Change-Id: I1627e7c6582d3a80d99dd2acc5171135a6a7bc4b
Reviewed-on: http://gerrit.openafs.org/11398
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
When a reparse policy is specified and AFSLocateNameEntry() returns
with STATUS_REPARSE, do not re-evaluate the path with the reparse
policy disabled. STATUS_REPARSE was returned because the FileObject's
FileName was modified and the IO Manager needs to reparse the request.
Change-Id: I290837357793d3961833923ea1d5300d08bf7dfc
Reviewed-on: http://gerrit.openafs.org/11397
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
When parsing a RelatedFileObject always refer to the RelatedFileObject
FileName and not the IrpSp->FileObject.
Set the output FileName to pRelatedCcb->FullFileName
Test pRelatedCcb->FullFileName for wild cards
Change-Id: I86f5bb7fc05eddc0d3d1ca9fbb069248af23be98
Reviewed-on: http://gerrit.openafs.org/11396
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
The FileName output parameter is used by the caller even when an
error occurs. In case of error it indicates that path that failed
to parse. Not all of the error paths set FileName.
Start AFSParseName() with FileName referring to
IrpSp->FileObject->FileName. It can be updated as required later.
Change-Id: I37c615aa815affec0c8f4dfef7d8c5777650c275
Reviewed-on: http://gerrit.openafs.org/11395
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
AFSParseName() is a very long complex function. Extract the parsing
of RelatedFileObject name parsing to a new function AFSParseRelatedName().
This removed ~160 lines of source code out of AFSParseName().
This changeset is not intended to introduce any functional changes.
Change-Id: If04a1bee0c104461f2d8bc33bca426e9ff71be74
Reviewed-on: http://gerrit.openafs.org/11394
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Print a better diagnostic message for cross-device link errors, which
happens when a clone volume is not in the same partition as the
parent read-write volume.
Change-Id: If58284a1dc53f8264fb17757f37c627fc2a378db
Reviewed-on: http://gerrit.openafs.org/10850
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
During review of commit c20c01185ed748b2bc823369a8f28cf004b7d1c9
gerrit flagged one of the changed lines as having a trailing whitespace
error. This patch corrects that error and several others that were
in the file.
Change-Id: I3668e67e456322cccdfa76df935951053f9b6a48
Reviewed-on: http://gerrit.openafs.org/11200
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Correct typos in a couple files. These were noticed while
researching code paths. Comment changes only. No code change.
afs/afs_stats.h has source file names updated on several lines.
Many source file name comments are wrong in this file.
I didn't attempt to correct them all, just the ones I bumped
into. If I bump into others in the future I'll fix them then.
rx/rx_call.h has source of enumerated types corrected.
Change-Id: Ie78b7f20b5c9c2261ec8a73701e77bdfbabd8465
Reviewed-on: http://gerrit.openafs.org/11172
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
These are new files and new content; fix the copyright notice and
license to reflect.
Change-Id: I8d5f00fb7edaf2e3855e2dc2a1af07bba471c0d6
Reviewed-on: http://gerrit.openafs.org/11362
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
C99 requires that objects with static linkage, which includes
global variables, be initialized to zero/NULL.
It is possible that old compilers required a hack of using one
explicit initializer and relying on the requirement from C99 that
the elements of the structure not listed in the initializer be
initialized as if it had static linkage. These incomplete initializers
seem to have been introduced to support old OS X compilers which
are not believed to still be in use.
Using a complete explicit initializer is undesired here, as the
rxkad statistics structures have a great number of elements and
the uuid structure is somewhat complicated.
Change-Id: Iefe7842cbf874252267cb3a8aee5d90ec2cab169
Reviewed-on: http://gerrit.openafs.org/11374
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
This variable is passed as an argument to the ma_vn_lock() compat
macro, which ignores the thread argument on some versions of FreeBSD.
Make the variable only be declared in those cases when it will be used.
Change-Id: I1ed10654fb402f4feec55d6d7c7ece6f0c78bc8e
Reviewed-on: http://gerrit.openafs.org/11373
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
In the same way as linux_ret.
An ugly hack, but retval is not really used for anything relevant at
the moment, and the compiler will warn about it being used uninitialized
otherwise.
Change-Id: Ia31ea6668ac3bc2edbec143d0b839f3e797ff424
Reviewed-on: http://gerrit.openafs.org/11372
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Modern compilers will warn when a variable in a nested scope hiding
a variable of the same name in an outer scope. One of the arguments
to afs_lhash_remove() is already named 'data'; don't reuse that name
for a local variable.
Change-Id: Icbb5010d298110cd4dab395fc5eec45e01ec9ba3
Reviewed-on: http://gerrit.openafs.org/11371
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
As far as I can tell, the afs_osi_Alloc contract does not
guarantee zeroed memory. On FreeBSD, with a debug kernel, it
definitely does not currently provide zeroed memory, returning
instead memory initialized with 0xdeadc0de.
Properly speaking, the role of calloc() is to both check for overflow
from the multiplication and to produce zeroed memory. However, since
we do not have a reasonable way to report failure, do not bother
checking for overflow at this time.
Change-Id: I187c2057d473fba869692c1dfa11735502b260c1
Reviewed-on: http://gerrit.openafs.org/11322
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Fix a couple of printf format errors that bite on FreeBSD 10 for i386.
Since time_t might be an int, it can't be printed with a long format.
Since time_t might be a long in general, cast to it to long when
printing.
Change-Id: Iecc4487adee7a64542dd2dc17f94485a6198e707
Reviewed-on: http://gerrit.openafs.org/11385
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
On platforms where size_t is unsigned int, the type of
cacheFiles * sizeof(AFSD_INO_T) is not an unsigned long as the format
string requires. Casting cacheFiles to unsigned long ensures that the
result is at least unsigned long, although it will still be wrong if
any architecture makes size_t be long long. Fixes build for FreeBSD
10 on i386.
Change-Id: Ifd124d81b16f53133293dd591f7f8cf2f7d3175a
Reviewed-on: http://gerrit.openafs.org/11384
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Add volscan and the manual page to the files in the server package.
Change-Id: I97c210da1e0d9d28682e555e92863c4c408b94da
Reviewed-on: http://gerrit.openafs.org/11370
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
The opr_Assert in opr_rbtree_remove is incompletely defined;
the opr_Assert macro is defined in opr.h, but the definition
for the opr_AssertionFailed routine it invokes is not included.
This allows the kernel module to build successfully even though
it retains a hidden undefined reference for opr_AssertionFailed.
However, the logic in obr_rbtree_remove ensures that this
particular opr_Assert can never fail - it is superfluous.
Some compilers (e.g. gcc for Linux AFS kernel module
builds) are able to recognize this and optimize it out. Others
(e.g. Solaris 5.12) do not, and when this happens the OpenAFS
build appears to succeed but the kernel module will fail to load
due to the undefined symbol.
Remove the superfluous opr_Assert.
This partially reverts commit 9f8b765bbdbb8913fcadbde8d3362039e9dc8e61.
Change-Id: I4ed2b1873c434e41dce0f2e474926bf8b449b819
Reviewed-on: http://gerrit.openafs.org/11296
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Commit 0fc27471e7da0c5de4addcdec1bfbca5208072cc avoids processing lock
requests for RO volumes, but it did this both in afs_lockctl() and in
the Linux-specific afs_linux_lock(). The changes in afs_linux_lock()
are incorrect, since they also avoid F_GETLK requests (whereas
afs_lockctl() just avoids F_SETLK* requests).
Additionally, the section in afs_linux_lock() incorrectly reports an
error, since it returns a positive EBADF error code, when we are
supposed to return -EBADF.
The result of all of this is that an F_GETLK F_WRLCK request for an RO
volume always fails with fcntl() returning 9 (EBADF), which is an
invalid return code for fcntl() F_GETLK (instead we should return -1
with an errno of 9). But if there are no locks, we should return
success anyway.
Just remove this section, since afs_lockctl() handles this case itself
anyway.
Thanks to Todd Lewis for reporting this issue.
Change-Id: Ia7f3f0b1bdbb922dca06be9de02a9c2b33f9ffee
Reviewed-on: http://gerrit.openafs.org/11316
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Fix the unpack in the example sysvmq audit reader script to
correctly unpack the message type, which is an native long.
From the msgrcv perl docoumentation:
Note that when a message is received, the message type as a native
long integer will be the first thing in VAR, followed by the actual
message. This packing may be opened with "unpack("l! a*")".
Change-Id: I5c5480c30d530b384d8057fb071b01e67f1b4ad2
Reviewed-on: http://gerrit.openafs.org/10445
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
Remove some unused variables left behind in a previous
refactor of flushing vcaches during afs_shutdown
(commit 80fe111f0044aa7a67215ad92210dc72cb7eb2c0).
Change-Id: Ie0a23cb08fc2946f1c400b8ce8e15ef3dc22ec20
Reviewed-on: http://gerrit.openafs.org/11310
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>
As pointed by Andrew deason during review of the 1.6 pullup of
commit ae27283550dab33704f30e18975722e0ed2c5424, psize is not
a parameter of HandleHeaderFiles, and in function HandleSpecialFile
it is of type inout since the value is first read by the += operation.
Fix this, and try to improve the description of psize too.
Change-Id: Ia728b20475f0c44b6104dc954aaa04d5f0f098b5
Reviewed-on: http://gerrit.openafs.org/11319
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Checking if the returned vcache is NULL or not is a bit of an indirect
way to check if an error occurred. Just check the return code itself,
to make sure we notice if any kind of error is reported.
Suggested by Chas Williams.
Change-Id: I61cc7304e9885ddaaebe96db3b12457cb6224420
Reviewed-on: http://gerrit.openafs.org/11321
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
The current semantics are that gop_lookupname() returns an unlocked
vnode; the previous code was written to a different semantic that
a locked vnode should be returned.
This makes a disk cache more likely to work on FreeBSD, but such
configurations remain not very tested.
Change-Id: I12ac77cd271be72af2fa4045c2ebf576847b625e
Reviewed-on: http://gerrit.openafs.org/11317
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Commit 4e6b7ab904d38d38da1b80a7342bd815668a8c09 separated the
compile_et rules for creating the source and header files using
the new -emit functionality. During review for inclusion in 1.6,
Chas Williams spotted a stray "-v 2" carried over to the rule
for creating the header file, where it doesn't apply. Remove it.
Change-Id: I554354eae0fa018e56fe7b78df69a43e5b5a0b07
Reviewed-on: http://gerrit.openafs.org/11347
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Fix vrequest leak introduced in commit
9930567bcf9655d3f562b210b2dc4b4a99226691.
Thanks to Andrew Deason for finding this error.
Change-Id: I8fc1391ab43f33c5a8208ff58d1d0641292cf63e
Reviewed-on: http://gerrit.openafs.org/11337
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Do not allow callers to pass a NULL cred to afs_CreateReq. This
avoids setting the uid of zero in the vrequest when no cred is
passed. Update callers to pass afs_osi_credp for an anonymous cred
when no cred is available.
Thanks to Andrew Deason for pointing out afs_osi_credp should be
used.
Change-Id: I05f694026ec72ab701160d9920e47c16cda46cd7
Reviewed-on: http://gerrit.openafs.org/11336
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Use a common file for most of the platform specific settings.
Change-Id: If95ad44de99fc3320570d53d706fed4d760fe67d
Reviewed-on: http://gerrit.openafs.org/11346
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Remove the AFS_SHORTGID macro from the param header files. There
are no usages in the rest of the source tree.
Change-Id: I417b6e90fa9a094bfef727134b640964596eceb3
Reviewed-on: http://gerrit.openafs.org/11345
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Always define AFS_HAVE_STATVFS. According to the man page, statvfs()
appeared in FreeBSD 5.0. Additionally, this macro is only used for
userspace which eliminates all disables except for FreeBSD 5.0 which
appears to have just been an oversight when the param file was created
from the 4.x param files.
Also fixes the comment so it reflects the actual choice.
Change-Id: Ibdcd694e9c4a0d0cecccd91a51962af6fb11ff36
Reviewed-on: http://gerrit.openafs.org/11344
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Fix the missing error location code introduced in commit
40fb2650b783fbafe51aefd3d0af7a6b0536c265
libafs: allocate vattrs in LINUX to reduce stack used
Use location number 104, which is the next in the sequence.
The code in this module is compiled when building the
nfs translator, which is only built under linux when
configure detects it is possible.
Thanks to Andrew Deason for spotting this error.
Change-Id: I00c834bc915fa3be7d5f27467895930e4f62aa76
Reviewed-on: http://gerrit.openafs.org/11351
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Background: when an entry is looked up after its parent changes,
afs_linux_dentry_revalidate re-looks-up the entry name in its parent.
If we get an ENOENT back, we d_drop the dentry, and in any other
situation we just d_invalidate it. As discussed in prior commits
997f7fce437787a45ae0584beaae43affbd37cce and
389473032cf0b200c2c39fd5ace108bdc05c9d97, we cannot simply d_drop the
dentry in all cases, because that would cause legitimate directories
to be reported as "deleted" if we just failed to lookup the entry due
to e.g. transient network errors (this causes, among other things,
'getcwd' to fail with ENOENT).
However, this logic has problems if the dentry name still exists, but
points to a different file; the case where 'tvc != vcp' in
afs_linux_dentry_revalidate. If that case happens, and the dentry is
still held open by some process, we will continue to try to reference
the vcache pointed to by the 'old' dcache entry, which is incorrect.
To maybe more clearly illustrate the issue, consider the following
cases:
$ sleep 9999 < /afs/localcell/testvol.ro/dir1/file1 &
$ rm -rf /afs/localcell/testvol.rw/dir1
$ mkdir /afs/localcell/testvol.rw/dir1
$ vos release testvol
$ ls -l /afs/localcell/testvol.ro
ls: cannot access /afs/localcell/testvol.ro/dir1: No such file or directory
total 0
d????????? ? ? ? ? ? dir1
Here, on the last 'ls', afs_linux_dentry_revalidate will afs_lookup
'dir1', and notice that it points to a different file (tvc != vcp),
and will d_invalidate the dentry. But since the file is still held
open, the dentry doesn't go away, and so we are still pointing to the
vcache for the old, deleted 'dir1'. That file doesn't exist anymore on
the fileserver, so we get an ENOENT when actually trying to stat() it
(we get a VNOVNODE from the fileserver, whcih gets translated to an
ENOENT).
A possibly more serious case is when the file is just renamed:
$ sleep 9999 < /afs/localcell/testvol.ro/dir1/file1 &
$ mv /afs/localcell/testvol.rw/dir1 /afs/localcell/testvol.rw/dir1.moved
$ mkdir /afs/localcell/testvol.rw/dir1
$ touch /afs/localcell/testvol.rw/dir1/file2
$ vos release testvol
$ ls -l /afs/localcell/testvol.ro/dir1
total 0
-rw-rw-r--. 1 1235 adeason 0 Jul 23 11:09 file1
$ kill %1
$ ls -l /afs/localcell/testvol.ro/dir1
total 0
-rw-rw-r--. 1 1235 adeason 0 Jul 23 11:10 file2
In this situation, the same code path applies, but the old file still
exists, so we will continue to use it without error. But since we are
still pointing at the old file, of course the results are incorrect.
Once we kill the process holding the file open, the bad dentry finally
goes away and the results are valid again.
To fix this behavior, d_drop the dentry in all cases, except when we
encounter an error preventing the lookup from being done. This ensures
that the dentry is unhashed from the parent directory in the scenarios
above, and so cannot be used for a subsequent lookup.
With this change, the only afs_lookup response that causes a simple
d_invalidate is when we encounter actual errors during the lookup
(such as transient network failures). This is correct, since in those
cases we don't _know_ that the dentry is wrong. For all other cases,
we do know that the dentry is wrong and so we must force it to be
unhashed.
Change-Id: I11a2db1e05d68a755a77815ec5e8d01ac7b36129
Reviewed-on: http://gerrit.openafs.org/11320
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>
In this function, hentry is the "previous" continuation entry that we
looked at, and centry is the "current" continuation entry. We keep
track of the previous continuation entry in case we need to update its
'next' pointer, which we do if we free one of the continuation entries
because it is empty after the removal.
So, this memcpy is supposed to copy the current entry to the previous
one, but the arguments are flipped, so we just copy zeroes to centry
(since hentry is initialized to zeroes early on in the function), and
hentry never gets set to anything besides zeroes.
The effect of this is that whenever a ptdb entry has more than one
continuation entry, and we free up any of them after the first one via
RemoveFromSGEntry, the previous continuation entry becomes blanked
(though the 'next' pointer should still be correct). This means the
membership information for that group is not recorded correctly, as it
loses a chunk of the IDs that it is a member of. The reverse mapping
should still be intact (the parent groups have a pointer to the
sub-group), but the group probably doesn't function correctly.
The reason this happened is because of the confusing conversion from
bcopy to memcpy. Most of the instances of bcopy/bcmp/bzero/etc were
converted (correctly) back in commit c5c521af, but the supergroups
implementation was added afterwards, in 8ab7a909, and contained a
bcopy reference. This bcopy was converted to memcpy in 58d5f38b, but
the argument order was not corrected, causing this bug.
To fix this, just flip the first two arguments of the memcpy. Just get
rid of the casts here, too, to match the code in the non-supergroups
RemoveFromEntry and elsewhere.
Change-Id: Ibcbbdcb13ef5c033ea3452555832a0fd3f916efd
Reviewed-on: http://gerrit.openafs.org/11340
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
The 10.1 release cycle is starting in a month, so let's get ahead of
the curve by adding the config bits now.
Change-Id: Ia17e1267dafee5c80d87a6bfc5e423982f83306d
Reviewed-on: http://gerrit.openafs.org/11328
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Fix the log level a debugging message introduced
in commit 9ddf9eca56e02be978ff7d065ee16c85de2cfb06.
Thanks to Ben Kaduk for reporting this issue.
Change-Id: I8913472aba8fe5247a29e31e3f04090bc0fce64e
Reviewed-on: http://gerrit.openafs.org/11314
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Users of generic_file_splice_write need to switch to
using iter_file_splice_write.
Change-Id: If4801d27e030e1cb986f483cf437a2cfa7398eb3
Reviewed-on: http://gerrit.openafs.org/11302
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>