Simon Wilkinson [Wed, 17 Mar 2010 11:56:12 +0000 (11:56 +0000)]
Don't count root session keyrings against quota
AFS PAM modules can call setpag() as root, regardless of the UID
being authenticated. This leads to the session keyring being created
using roots quota - on some systems (RHEL5) this quota is both small,
and of a fixed size.
Modify our keyring allocation code so that when a keyring is created
by root, we don't do any quota checks.
Marc Dionne [Sat, 29 Jan 2011 00:41:32 +0000 (19:41 -0500)]
Linux: 2.6.38: Adjust for permission inode operation changes
The permission i_op has a new signature with a flags argument, and
must now deal with RCU path walking.
- Fix existing configure test for this i_op, it succeeds when it
shouldn't
- Add a new configure test for the new signature
- Make our permission i_op "RCU-walk aware" - return ECHILD if
called in that mode
Marc Dionne [Sat, 29 Jan 2011 00:03:39 +0000 (19:03 -0500)]
Linux: allow compile flags to be passed to AC_CHECK_LINUX_BUILD
Some linux autoconf tests require particular compile flags such as
-Werror. Add a parameter to the AC_CHECK_LINUX_BUILD macro that
lets the caller pass in any needed special flags.
Simon Wilkinson [Tue, 27 Apr 2010 16:41:22 +0000 (17:41 +0100)]
Linux: Add general autoconf macro for Linux kernel
Add AC_CHECK_LINUX_BUILD() to do a standardised Linux build, which
takes a "checking" message, the autoconf variable to use to cache
the results, headers and code to run, preprocessor variable to
define, and a description of that variable.
Andrew Deason [Sun, 3 Oct 2010 23:27:19 +0000 (18:27 -0500)]
vol: Log ignored dirs that look like partitions
If we see a /vicep*-like directory when we VAttachPartitions, and we
ignore it because it lacks an AlwaysAttach, log that we ignored it.
This may make things less confusing to admins that just try to create
a /vicep* directory and don't know why it doesn't work.
Andrew Deason [Wed, 10 Mar 2010 00:07:18 +0000 (18:07 -0600)]
vos: Mark longjmp-used variables as 'volatile'
vsprocs tries to do error recovery by calling longjmp from a signal
handler. Although this is quite error-prone since we call a ton of
non-async-signal-safe functions, make it a bit more likely to work by
marking variables that are used after the longjmp as volatile. This
reduces how often (depending on the platform) these values will be
completely worthless after a longjmp since they were cached in a
register or similar.
FIXES 125535
Reviewed-on: http://gerrit.openafs.org/1557 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 fe3ff8e91237f35fed33d6d417830e0fe44c6479)
Andrew Deason [Tue, 6 Jul 2010 17:36:27 +0000 (12:36 -0500)]
vos status: actually show created time
The 'created' field in 'vos status' output was being reported as
something else. Make 'vos status' actually report the time the
transaction was created in that field.
Russ Allbery [Thu, 23 Dec 2010 01:01:34 +0000 (17:01 -0800)]
Add $named to Should-Start for openafs-client
* Add $named to Should-Start in the openafs-client init script since the
client may do DNS lookups for the VLDB and file servers during startup
in some situations. (Closes: #586226)
Simon Wilkinson [Wed, 11 Aug 2010 16:25:36 +0000 (17:25 +0100)]
LINUX: Use correct type of error in flock code
The flock code gets a kernel error code from afs_posix_lock_file()
but then passes this error code through afs_convert_code (which sees
that it is already negative, and returns EIO). Instead, we should just
return afs_posix_lock_file()'s code direct to our caller.
Derrick Brashear [Wed, 30 Jun 2010 19:35:38 +0000 (15:35 -0400)]
update ticket5 from heimdal
includes updated instructions for updating.
note that gen_glue.c in lib/asn1 has a bug which omits
a needed newline in the "const struct units * asn1_%s_units(void);",
line.
Marc Dionne [Fri, 5 Nov 2010 21:30:02 +0000 (17:30 -0400)]
Linux: define llseek operations
With kernel 2.6.37 it is now mandatory to define the llseek operation
for files and directories. If these are not defined, no_llseek is
called, and any attempt to seek returns ESPIPE.
Most file systems use generic_file_llseek, but it seems safer to use
default_llseek which is what the vfs used to call for us by default.
In 2.6.37 these two functions are actually functionally identical.
Marc Dionne [Wed, 13 Oct 2010 23:11:25 +0000 (19:11 -0400)]
Linux: fix statfs configure test
The change to the statfs configure test that was made for 2.6.36
broke the test for older kernels. The new test is based on a call,
and that will generate a warning but not an error when the arguments
don't match the prototype.
Take another tack, and revert to the old style test, but with the
simple_statfs function instead of vfs_statfs.
Reviewed-on: http://gerrit.openafs.org/2975 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 59927e20052c3f075e0269e46691bc94c3974f86)
Marc Dionne [Wed, 11 Aug 2010 22:20:59 +0000 (18:20 -0400)]
Linux: adapt to truncate sequence changes
As part of changes to the truncate sequence, inode_setattr() no
longer exists, and all filesystems have to define the setattr op
so we can assume that it is not NULL.
Introduce a compat inline function afs_inode_setattr that hides
the tests and the different versions from the main code.
Note that the existing test for the inode_setattr() return type
will fail, but the value is no longer used in that case.
Marc Dionne [Wed, 11 Aug 2010 21:18:32 +0000 (17:18 -0400)]
Linux: use %pI4 if NIPQUAD is not available
The definition of NIPQUAD has been removed from the kernel headers
in the mainline kernel. Replace it by using the %pI4 format
specifier which takes the IP address as a single argument.
Marc Dionne [Wed, 11 Aug 2010 22:55:29 +0000 (18:55 -0400)]
Linux: switch to evict_inode
In 2.6.36, the delete_inode and clear_inode inode operations
are replaced by evict_inode.
Rename our current clear_inode to evict_inode, and add a few
things that were previously handled by the generic delete_inode.
Marc Dionne [Wed, 11 Aug 2010 23:28:53 +0000 (19:28 -0400)]
Linux: Rework statfs super block operations configure test
The configure test to detect if the statfs super block operation
needs a dentry argument is based on vfs_statfs, and assumes that
its signature matches the one of the operation. In 2.6.36 this is
no longer true and the test fails.
Rework the test to actually test the operation we're interested in.
Simon Wilkinson [Thu, 22 Apr 2010 16:56:25 +0000 (17:56 +0100)]
Linux: RedHat packaging updates for RHEL6
Update our bundled spec file and related tools so they can be used
to build OpenAFS on the RHEL6 beta.
- Make kmodtool recognise el6 as having "modern" kernel naming
conventions
- Replace %{PACKAGE_VERSION} (which seems to have disappeared)
with the standard %{version} macro
Thanks to billings and phalenor on IRC for their testing efforts.
Andrew Deason [Wed, 1 Sep 2010 16:18:56 +0000 (11:18 -0500)]
RedHat: Find krb5-config in /usr/bin
In RHEL6, krb5-config is no longer in /usr/kerberos/bin/, but is in
just /usr/bin/. So, try to use /usr/bin/krb5-config if we cannot find
/usr/kerberos/bin/krb5-config and krb5config was not specified.
This is a 1.4-only change, as the 'configure' on more modern branches
should have the ability to find krb5-config automatically.
Reviewed-on: http://gerrit.openafs.org/2646 Tested-by: Andrew Deason <adeason@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit c2eba9d57adc79b05165fc8aebaf751ea89282f5)
Change-Id: I46c6f0e3d7c2ce427eacfbb82366a7da3156d9bd
Reviewed-on: http://gerrit.openafs.org/3514 Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Fix the sample CellServDB entry output by afs-newcell
* Fix the sample CellServDB entry printed by afs-newcell if the cell
isn't found in /etc/openafs/CellServDB to include the correct server
syntax. Thanks, Peter Palfrader.
* Add a dependency on libc6-dev to openafs-modules-dkms. dkms doesn't
depend on it because most kernel modules don't need it, but openafs
builds userspace helper programs. Thanks, Peter Palfrader.
Russ Allbery [Sat, 28 Aug 2010 00:52:36 +0000 (17:52 -0700)]
Use dpkg --print-architecture in openafs-fileserver.config
* Use dpkg --print-architecture, not --print-installation-architecture,
in the openafs-fileserver config script. The latter is deprecated.
Thanks, Peter Palfrader. (Closes: #594488)
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.