Andrew Deason [Fri, 6 Aug 2010 18:01:51 +0000 (13:01 -0500)]
Include com_err.h in dumpstuff.c
src/volser/dumpstuff.c uses afs_error_message in its error reporting,
but it does not include com_err.h, so it does not get the prototype
for afs_error_message. The default return type for unprototyped
functions is 'int', so the return value of afs_error_message can get
truncated on platforms where sizeof(char*) > sizeof(int), causing a
segfault whenever the result of afs_error_message is logged.
This is a 1.4-only change. This was fixed in the 1.5 branch in the
midst of the larger warning cleanup effort.
Andrew Deason [Fri, 18 Jun 2010 22:20:22 +0000 (17:20 -0500)]
ubik: ntohl on reading the replay log
When attempting to read the replay log, ubik was not ntohl'ing all
integers that were read in from the log, causing the log to appear
invalid on little-endian systems. Fix it.
This problem manifests as apparent corruption in the database on top
of ubik when a commit is occurring when we are shut down, or a disk
error is encountered during a commit.
Reviewed-on: http://gerrit.openafs.org/2224 Tested-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit eec0d94f519b3e27f255b9b7a637df043951424e)
* The openafs-fileserver init script now depends on $named since
apparently the volserver requires DNS during startup. Thanks, Jaap
Winius. (Closes: #589783)
* Add a status command to thet openafs-fileserver init script.
Russ Allbery [Sat, 12 Jun 2010 22:39:23 +0000 (15:39 -0700)]
Do not use AFS_PTR_FMT or %p in 1.4
The afs_snprintf in the 1.4 series did not support %p, so don't use
it when logging fileserver messages. Replace with 0x%lx and add a
cast to unsigned long, which should serve as an acceptible substitute.
Jason Rogers [Mon, 15 Feb 2010 23:19:12 +0000 (17:19 -0600)]
prdb_verify -rebuild with supergroups fix
This change eliminates the redundant iteration over the
supergroup[] array in DumpRecreate. By iterating over both
this array and entries[], duplicate au lines are created
and the count variable becomes incorrect. Furthermore,
the au lines created in the supergroups[] section were
incorrectly in the form of au <group> <member> instead
of au <member> <group>.
FIXES 126500
Change-Id: I087772b63934406273f153f4b8a581d965f1e4d5
Reviewed-on: http://gerrit.openafs.org/1316 Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Tested-by: Michael Meffie <mmeffie@sinenomine.net> Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit fa2536c02cf26f7db30bf623e95f42be88138d14)
(cherry picked from commit dfa356732fd10073c3b777ccf48f753fcd528c93)
Reviewed-on: http://gerrit.openafs.org/1945 Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 3fc5c5311fc4bfe5586818fa26bdccd846d4c8cc)
only valid addr/port pairs are registered in the hash table.
add then remove when changing addresses.
make host restoral properly hash hosts.
remove should remove the address we asked for and not simply the
primary address.
Russ Allbery [Mon, 22 Mar 2010 19:42:48 +0000 (12:42 -0700)]
Move non-executable stack assembly code to end of file
The non-executable stack annotation used for Linux works by adding
an additional section to the generated object. The annotation added
in 9bfd03d723a9cf17673f40513a7adde1d503bcbc was added to the beginning
of each assembly file. This caused build failures on Linux s390
because the remainder of the assembly code was then put in that
section, which was discarded during linking.
Add the annotation to the end of each assembly file instead, following
the instructions at:
Marc Dionne [Thu, 22 Apr 2010 21:22:37 +0000 (17:22 -0400)]
Initialize oldvtix
Initialize the variable to avoid compiler complaints that it
could be used uninitialized. Use a sentinel value and issue
a warning if we try to use the variable and we haven't set
it to a useful value.
Andrew Deason [Wed, 21 Apr 2010 17:41:21 +0000 (12:41 -0500)]
Recover from afs_GetVolSlot errors
afs_GetVolSlot can panic in a few different ways, such as failing to
read from or write to VolumeInfo. Instead of panic'ing, return an
error to the application. Adjust callers to deal with getting a NULL
volume returned.
Based on a patch by Mike Meffie.
Change-Id: Ibb301fed795ee9ee5906b8e7973945a06218b8f1
Reviewed-on: http://gerrit.openafs.org/1801 Tested-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry-picked from commit 80f05473428969ff71d1791cda8cb09d30223724)
Marc Dionne [Fri, 5 Mar 2010 22:54:42 +0000 (17:54 -0500)]
Linux: replace invalidate_inode_pages
This helper has been deprecated for a while, and gets removed
with 2.6.34.
Replace it with invalidate_remote_inode, which has been around for
all of 2.6's life, according to Chaskiel in RT #124377.
Change-Id: I8658b454e1c997c041f654ba55d06f713ea25459
Reviewed-on: http://gerrit.openafs.org/1523 Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 80481fb14ea9301b0f6b3503d07ecaef39aef0d8) Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/1988
Russ Allbery [Tue, 4 May 2010 23:26:15 +0000 (16:26 -0700)]
Check if AFS is mounted before killing processes with open files
* Skip killing processes with files open in AFS if AFS does not appear
to be mounted according to /etc/mtab. Otherwise, we may call lsof
without a specific mount point and kill far more processes than we
intend to. (This code is disabled by default, so this problem would
only be seen by people who enabled it.)
Russ Allbery [Tue, 4 May 2010 22:06:52 +0000 (15:06 -0700)]
In the openafs-client init script, don't assume AFS is mounted at /afs
* In the openafs-client init script, don't assume that AFS is mounted on
/afs when unmounting it or killing processes with AFS files open.
Instead, parse the output from mount to find the AFS mount point.
Dan Hyde [Tue, 2 Feb 2010 15:37:47 +0000 (10:37 -0500)]
VOL_LOCK needed when traversing DiskPartitionList
VLockPartition sets VOL_LOCK, opens (perhaps creating) the lock file
for a partition, and flock's it. VUnlockPartition, sets VOL_LOCK, and
closes the lock file fd.
VLockPartition is called from the salvager. Nothing ever calls
VUnlockPartition.
VPFullUnlock is called every 30 seconds, does NOT set VOL_LOCK, and
happily closes any lock file fd it finds, breaking any lock set with
flock.
Other routines use the VOL_LOCK when traversing DiskPartitionList.
Change-Id: I28aa02488a6b53dc9f9aa9b2053c71d29222bdaf
Reviewed-on: http://gerrit.openafs.org/1213 Reviewed-by: Dan Hyde <drh@umich.edu> Tested-by: Dan Hyde <drh@umich.edu>
(cherry picked from commit 105481d3348a93d33695fb705f9fa5c8af210e7e) Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-on: http://gerrit.openafs.org/1595
(cherry picked from commit 3c1d60a19ccdc23ecd9eb0ca79bd72816abcd82e)
Marc Dionne [Wed, 27 Jan 2010 00:48:24 +0000 (19:48 -0500)]
Linux: don't count pag keys against root's keyring quotas
Keys associated with PAGs are created with root ownership for
security reasons, which means that they count agains root's
keyring quotas. The default configuration used by most distros
restricts root to the same quotas as a regular user, so a single
user can potentially fill up the quota and prevent new pags from
getting created system-wide.
This can also be an issue for busy multi-user systems where the
default maximum number of keys (200 currently) can easily be reached.
Reviewed-on: http://gerrit.openafs.org/1167 Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit a3812f211a56c0d6e0a7ff8a97f157707d3d8c28)
Russ Allbery [Tue, 4 May 2010 21:27:36 +0000 (14:27 -0700)]
Preserve AFS mount point and cache directory in cacheinfo
* Preserve the AFS mount point and cache directorys set in
/etc/openafs/cacheinfo if the file already exists rather than
overwriting them with the defaults. Thanks, Liam Healy.
(Closes: #580077)
Marc Dionne [Wed, 24 Mar 2010 23:29:28 +0000 (19:29 -0400)]
Print rxdebug statistics as unsigned values
bytesSent and bytesReceived are unsigned. Print them as such
to avoid printing negative numbers for large values. This is
already the case in the master branch.
Dan Hyde [Wed, 13 Jan 2010 19:38:47 +0000 (14:38 -0500)]
volmonitor keep vtrans lock
VolMonitor must maintain the VTRANS lock the whole time it is walking
the allTrans list. Failure to do so can cause core dumps trying to
access memory that has already been free'd.
Two versions of this change were coded and tested. The other version
used the VTRANS lock only around a THOLD, but needed a TRELE, too.
Timing tests were run counting the number of vos status, vos listvol,
and vos backupsys operations that could be performed during a fixed
number of vos status operations. The THOLD/TRELE version caused other
vos operations to run about 5% slower.
FIXES 126110
Change-Id: I7e749d30c955867faacafa978d7d643dee648ca3
Reviewed-on: http://gerrit.openafs.org/1098 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit d4f6ece19b05f2233e53f2d3c59f92316ec5ec3a)
Change-Id: Ic12bb6687a9c34e85abc2023c02264de6ae27614
Reviewed-on: http://gerrit.openafs.org/1588 Reviewed-by: Dan Hyde <drh@umich.edu> Tested-by: Dan Hyde <drh@umich.edu>
(cherry picked from commit 190ef2cb29577f2fcf1853149cf210fdf0736ae3)
Andrew Deason [Wed, 3 Feb 2010 19:02:23 +0000 (13:02 -0600)]
Create missing root directory when ORPH_ATTACH
When we are salvaging with ORPH_ATTACH, orphans are normally attached to
a volume's root directory. If the volume is missing a root directory,
however, nothing is attached, and the volume can appear empty or
unusable.
So, to make it possible to get a useful volume out of a volume that lost
(only) its root directory, create a new root dir, and attach orphans to
that root.
Russ Allbery [Fri, 26 Mar 2010 19:25:01 +0000 (12:25 -0700)]
Don't add CellServDB records if AFSDB is in use
* If the user configures openafs-client to use AFSDB records for VLDB
server location, don't prompt the user for VLDB servers for the local
cell even if they're not present in CellServDB and don't try to add an
entry for the local cell to CellServDB. (Closes: #575299)
Russ Allbery [Mon, 22 Mar 2010 22:41:38 +0000 (15:41 -0700)]
Build with -fno-strict-aliasing
* Build with -fno-strict-aliasing. The upstream development branch has
a better fix that selectively enables this for specific files with
known problems, but be conservative for the stable release.
Russ Allbery [Mon, 22 Mar 2010 19:42:48 +0000 (12:42 -0700)]
Move non-executable stack assembly code to end of file
The non-executable stack annotation used for Linux works by adding
an additional section to the generated object. The annotation added
in 9bfd03d723a9cf17673f40513a7adde1d503bcbc was added to the beginning
of each assembly file. This caused build failures on Linux s390
because the remainder of the assembly code was then put in that
section, which was discarded during linking.
Add the annotation to the end of each assembly file instead, following
the instructions at:
Dan Hyde [Wed, 6 Jan 2010 15:49:39 +0000 (10:49 -0500)]
volmonitor copy link before calling free
Copy tt->next before TRELE(tt) calls free(tt).
We have a core file from a VTRANS_OBJ_LOCK(tt) assert failure, with tt
pointing into glibc's malloc data structures.
(cherry picked from commit 81ca1e19600681a2c5696610130b9a39809bb1c1)
Change-Id: I5ba81f9e3a76f52578ab3b9dec394b6d95b03934
Reviewed-on: http://gerrit.openafs.org/1586 Reviewed-by: Dan Hyde <drh@umich.edu> Tested-by: Dan Hyde <drh@umich.edu> Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 0583af324ca2cbc556722b9e84d85cad49cfc622)
Andrew Deason [Tue, 16 Feb 2010 17:08:38 +0000 (11:08 -0600)]
h_TossStuff_r: make sure host does not go away
When h_TossStuff_r h_NBLock_r's a host, it is not only possible for
someone else to grab a hold on the host, but in theory it's also
possible for someone to hold a host, release it, and for the host to be
deleted again (assuming some callers hold HOSTDELETED hosts, which they
should not be doing).
To make this safety check a bit more robust, hold the host in
h_TossStuff_r before h_NBLock_r'ing, to ensure that it does not go away
while we're waiting for H_LOCK.
Reviewed-on: http://gerrit.openafs.org/1330 Tested-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 380bd77c328d8d83a007cd97f6564fcb5b990a73)
Change-Id: I19d001dba8b0c96b694aefdba2475f0103d33e44
Reviewed-on: http://gerrit.openafs.org/1368 Tested-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit b78eeb0cca48c65d4466052d207fa22f08a8fa70)
Andrew Deason [Mon, 15 Feb 2010 16:55:33 +0000 (10:55 -0600)]
h_TossStuff_r: check held-ness after lock
h_TossStuff_r checks if a host is held or locked by another thread
before trying to delete the host. Unfortunately, it checks if it is
locked before checking if it is held, and the lock check drops H_LOCK.
Thus, another thread could hold the host while we don't have H_LOCK, and
we could delete a host that is being held.
Although it is a bug if any thread holds a host that is being deleted,
some instances of this still exist, so make the check more robust.
Reverse the order of the tests, so we detect if someone held the host
while the lock check dropped H_LOCK.
Also log when this happens, as it indicates a bug occurring.
Andrew Deason [Mon, 15 Feb 2010 22:22:56 +0000 (16:22 -0600)]
Allow GetSomeSpace_r to select an optimal host
Previously GetSomeSpace_r would never find an 'ideal' host for which to
clear callbacks, since lih0_r and lih1_r required a non-NULL rock to do
anything. Remove the requirement for the passed-in host rock to be
non-NULL, and make lih*_r more threadsafe, by passing in a parameter
struct for the rock.
Also attempt to make the GSS_r code a bit more clear with some
descriptive variable names and such.
Russ Allbery [Mon, 8 Mar 2010 23:45:17 +0000 (15:45 -0800)]
Require $remote_fs before stopping as well
This isn't strictly necessary, but it avoids the Lintian warning and we
can clean it up after finding a better approach for what /usr/bin/fs
currently does.
Russ Allbery [Mon, 8 Mar 2010 22:18:05 +0000 (14:18 -0800)]
Initial changelog for 1.4.12~pre4
Add upstream change list since the deltas that I pulled up. Switch
the download area over to the candidate releases. (1.4.12 will
probably be released before this package is uploaded, but we'll pull
1.4.12~pre4 first to get the packaging updated.)
1.5 deals with this differently. for now, don't build fc_test (rx needs
libsys so it can deal with network config from userspace; the sys/rxkad
dependancies are circular if so. so, no)
OpenBSD 4.7 (currently in beta) removes the (dummy) VREF() macro from the
system header files. For at least as far back as OpenBSD 3.6, all this
macro does is expand to a call to a system routine by the same name in
lower case. This patch therefore replaces the single OpenBSD use of
VREF() with a direct call to the routine to which it expanded.
Claudio Bisegni [Mon, 1 Mar 2010 19:41:48 +0000 (20:41 +0100)]
OSXPreferencePane
checkAfsStatusForStartup method modification for search /afs volume for determinate if afs is on has been transfered into checkAfsStatus. checkAfsStatusForStartup method is used to check when afs start axitn system startup. Anyway these are only workaround we must use osx api or afs api to make this job.
A prior update (ChangeID: Ie6af2d3fd9c5166dd2d884c22d287c180b24fab1)
stops compile_et from being (p)installed into a separate directory.
Unfortunately, there's a second rule in the Makefile exhibiting the
same behaviour that was missed (the decision of which rule is used is
determined by whether a 'make install' or 'make dest' is requested).
This patch fixes the second ruleset as well.
Derrick Brashear [Wed, 24 Feb 2010 16:20:51 +0000 (11:20 -0500)]
remove dropbox attribute leak fix
change 6ec18461649d3e4f44b2476f886bcc480c456500, avoid leaking stat info,
appears to have side effects on at least macos, crashing the system
coreservicesd. revoke the change until the exact behavior we want is
better understood.
Anders Kaseorg [Sun, 21 Feb 2010 01:28:42 +0000 (20:28 -0500)]
Linux: Fix conversion of whole-file locks
An overflow bug in commit 49b7bbdd3b45df694fadbef48f9ed99d9bfe07b9
caused whole-file locks to be treated as byte-range locks, which fail
to be propagated to other machines.
Fix this by setting l_len = 0 for locks that range to the end of the
file.
Anders Kaseorg [Sat, 20 Feb 2010 18:28:59 +0000 (13:28 -0500)]
Linux: Use kbuild to check for UML
<linux/autoconf.h> is automatically included by kbuild; you aren’t
supposed to include it directly. That breaks in 2.6.33 because
<linux/autoconf.h> is moving to <generated/autoconf.h>.
Andrew Deason [Fri, 12 Feb 2010 23:44:31 +0000 (17:44 -0600)]
Check for HOSTDELETED before h_Hold_r
A few places h_Hold_r a host and later drop and reacquire H_LOCK without
checking if the hostFlags contains HOSTDELETED. This can cause a race
with h_TossStuff_r where we later reference a host that is about to be
freed or already has been freed.
Add checks for HOSTDELETED in these places, and skip over the deleted
hosts.
Andrew Deason [Fri, 12 Feb 2010 22:30:44 +0000 (16:30 -0600)]
Correct the h_Enumerate_r hostList safety check
Ide1e5aca7c2c4a4af3f62bc07821db694f2f9999 added safety checks for a few
traversals through hostList, including the traversal in h_Enumerate_r.
Unfortunately, h_Enumerate_r may not hold H_LOCK over its entire
traversal (h_Release_r can drop and reacquire it), so the value of
hostCount is not guaranteed to stay the same.
A host may be deleted during the loop, or right near the end, decreasing
hostCount to below our current running 'count' of hosts, triggering the
panic unnecessarily. So instead, remember the value of hostCount.
Derrick Brashear [Sun, 21 Feb 2010 22:15:26 +0000 (17:15 -0500)]
idledead client dont interrupt writes
allowing failover is nonsensical, there's nothing to fail to. keep trying to
write. if we want to change this, we need to handle it better than just this.
Simon Wilkinson [Tue, 9 Feb 2010 19:53:40 +0000 (19:53 +0000)]
Linux: Use current_creds() if stashed creds fail
If we can't use our stashed credentials (because SELinux hates us,
most likely), then fall back to trying the processes current credentials
instead of just oopsing.
afs_TruncateAllSegments() make sure correct afs_size_t comparison is
used when selecting dcache entries for truncation
Insure that afs_TruncateAllSegments() uses the correct [64-bit]
comparison when deciding whether to truncate chunks:
alen - AFS_CHUNKTOBASE(tdc->f.chunk) for a file > 2GB would fail
to be recognised negative with an "afs_int32 newSize", even with
alen = 0 and big tdc->f.chunk.
OpenBSD: don't use AFS_GLOBAL_SUNLOCK on single processor system
Put back the header directives that only turns on AFS_GLOBAL_SUNLOCK
when compiling for multiprocessors system. When enabled on a single
processor OpenBSD system, it is possible to put the entire system
into a lengthy (minutes) lock state when performing multiple AFS
activities. The system behaves MUCH better when AFS_GLOBAL_SUNLOCK
is not set (no problems encopuntered). This whole locking mechanism
needs a bit more examination on OpenBSD before this is useful in
single processor mode.
A shutdown or unmount of AFS on OpenBSD will invariably result in a kernel
panic. This is because the afs_unmount() routine does not (can not?) force
vnode releases if the vnode is still busy. However, it continues on
nonetheless and dies a horrible death a little later.
This update causes a return from afs_unmount() with EBUSY if all the vnodes
weren't released. This results in error messages on shutdown but the overall
process continues more reliably and reboots, for example, work.
There is likely a better solution to this but at least this is no worse than
a system crash and it doesn't require console (or power button) intervention
so it should do until I have the chance to explore further.
Starting with OpenBSD 4.2, the interface list returned by sysctl using
NET_RT_IFLIST contains multiple versions of the data. This really
messes up the rx_getAllAddr_internal() routine that returns a list of
valid interfaces for the system (to the point where none are returned).
This change adds a routine that cleans up the data returned by sysctl
so it returns only a single (the most current) version of the data.
That stops afsd (among others) from being cranky when it starts up.
The internal malloc memory types for IPv6 (M_IP6OPT, ...) conflict
with the type numbers used to designate AFS memory (M_AFSFID, etc.).
This change moves the AFS memory type to a new number that does not
conflict. This is not a serious issue but can create real confusion
when trying to debug or track memory issues, among other things.