Commit Graph

6566 Commits

Author SHA1 Message Date
Simon Wilkinson
146b732fc8 Translate messages from ktc_SetToken
Error messages from ktc_SetToken weren't being passed through com_err,
leading to the confusing

   unable to obtain tokens for cell inf.ed.ac.uk (status: 11862788).

error message. Instead, call into afs_com_err here, which gives:

   a pioctl failed while obtaining tokens for cell inf.ed.ac.uk

Much nicer ...

Change-Id: Id4c7e6f6a2f52efc6ac1db9fa007ba1a452092fe
Reviewed-on: http://gerrit.openafs.org/822
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-16 17:04:38 -08:00
Simon Wilkinson
fda55b178c Better errors from aklog
Since the great com_err fracture, aklog has only returned decent
error messages from AFS, leaving Kerberos errors untranslated.
Needless to say, this causes user confusion and distress.

This patch uses the error display proc hook to call out to the real
com_err in situations where AFS can't supply an error message, giving
clearer errors for Kerberos problems.

Change-Id: I8832b755beb84c593e1b2eace5c356e71a582b2a
Reviewed-on: http://gerrit.openafs.org/821
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-16 16:58:15 -08:00
Derrick Brashear
9bfd03d723 asm unexecutable stack
make stack not executable in assembled files

FIXES 125491

Change-Id: I396680b6877843201f6c07d5607385044abd5e74
Reviewed-on: http://gerrit.openafs.org/818
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-16 16:45:08 -08:00
Jeffrey Altman
65db615024 Windows: Code signing with cross-signed certificates
Permit the version of signtool.exe to be specified with
the SIGNTOOL environment variable.

Add the CODESIGN_CROSS_CERT environment variable to
specify the cross-signed certificate to be used

LICENSE MIT

Change-Id: Ib549e31f1f240e0de2cedfabac9bb998ee58a517
Reviewed-on: http://gerrit.openafs.org/825
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
2009-11-16 14:53:29 -08:00
Jeffrey Altman
7d44a08771 Windows: Error mapping for VBUSY and VRESTARTING
Add error mapping for VBUSY and VRESTARTING to
cm_MapRPCError().  Return CM_ERROR_ALLBUSY.
This prevents an unknown error from being returned
to the SMB redirector.

LICENSE MIT

Change-Id: Ie8bf8bc88e087a8eef428444ca07c7ca7c4621a8
Reviewed-on: http://gerrit.openafs.org/826
Reviewed-by: Jacob Thebault-Spieker <summatusmentis@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
2009-11-16 14:52:53 -08:00
Jeffrey Altman
1594cf9892 Windows: Use STATUS_IO_TIMEOUT where STATUS_TIMEOUT was returned
STATUS_TIMEOUT causes the smb redirector to drop the connection.
STATUS_RETRY is interpreted by the smb redirector as if the error was
generated by the transport stack and not the smb server.
STATUS_IO_TIMEOUT is listed in the SNIA CIFS 1.0 spec as a valid
return code for the smb server.  Lets us that.

LICENSE MIT

Change-Id: I842a78cde3d975c88bbeb64294dd53cc8b101047
Reviewed-on: http://gerrit.openafs.org/831
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
2009-11-16 14:52:21 -08:00
Jeffrey Altman
4c25f00088 Windows: Fix port assignment to use network byte order
Service port numbers are stored within sockaddr* structures
and returned by afsconf_FindService() in network byte order.
getAFSServer() and afsconf_GetAfsdbInfo() accept and return
service port numbers in network byte order.

When processing the special case for 7002 and 7003 in
afsconf_GetAfsdbInfo(), the comparisons must consistently
use network byte order.

When assigning port numbers for AFSDB lookups, getAFSServer()
must use network byte order.

Document the use of network byte order for each variable.

LICENSE MIT

Change-Id: I2163826e8a234a1d19474b2eba3d36335ba12afb
Reviewed-on: http://gerrit.openafs.org/830
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
2009-11-14 22:04:14 -08:00
Jeffrey Altman
9d245a2622 Windows: ports in the cache manager are stored in network byte order
When assigning ports from SRV/AFSDB lookups, convert to network
byte order when assigning them to cm_server objects.

LICENSE MIT

Change-Id: Ic22a445c9f6433f9f7544774ea9952d82fcdba8a
Reviewed-on: http://gerrit.openafs.org/791
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
2009-11-14 20:57:54 -08:00
Andrew Deason
c53abbb3e8 Make ktc_curpag also detect ONEGROUP PAG gids
ktc_curpag falls back to looking at the group list if the VIOC_GETPAG
pioctl fails. If we're in AFS_LINUX26_ONEGROUP_ENV in the kernel,
though, ktc_curpag still looks for two groups, instead of the one
combined group. Add a check for the big one group in the fallback if
we're on LINUX26.

Change-Id: I28e5eda5c62f13a6fb466c8a2b04d2628706498f
Reviewed-on: http://gerrit.openafs.org/815
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-13 04:52:09 -08:00
Simon Wilkinson
5e99d56cf2 Use set_page_writeback and end_page_writeback
Calling set_page_writeback and end_page_writeback is necessary to
ensure that the dirty page radix tree and the page dirty flags
tally. The results of end_page_writeback are also used by the
bdi code to prioritise writeback. The Linux kernel
documentation contains further warnings of doom for what may
happen due to not calling them.

Adding set_page_writeback and end_page_writeback also allows us to
unlock the page earlier (the page can be locked any time after the
writeback flag is set). This means that we're not calling the
backing filesystem's ->write function with our pages locked, and
should help reduce contention and the potential for deadlocks there.

Change-Id: I9130b2ad9a09c6b9b16a0f63d7b4a614a93de8d3
Reviewed-on: http://gerrit.openafs.org/819
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-12 19:27:07 -08:00
Marc Dionne
dc85abcaa6 Linux: Use the kernel's credentials structure
Recent kernels (2.6.29 and above) have a separate ref-counted
structure for holding credentials.  Use it directly instead of
keeping a separate afs specific structure that shadows the same
information.

Also adapt Linux for the change from cr_xxx to afs_cr_xxx wrappers.

Reference counting is done with the appropriate get/put calls.

Change-Id: I1135bb5a66cda51cee4fa9f3f3e63eaa9af28f61
Reviewed-on: http://gerrit.openafs.org/797
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 13:33:28 -08:00
Andrew Deason
97d3fcfcd1 Do not check *aoutSize in PGetPAG
*aoutSize is always zero in pioctls, since afs_HandlePioctl handles
checking the output buffer size, and sets outSize to 0 before calling
the pioctl. So, PGetPAG was always returning E2BIG; remove the check to
make it work.

Change-Id: Ibed16b35ea14237f44a494add8c7a4a48e0c2b71
Reviewed-on: http://gerrit.openafs.org/814
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 09:38:05 -08:00
Simon Wilkinson
e854e26ef1 Update warning inhibition
A number of recent changes haven't caught all of the locations where
warning inhibition can be removed. This patch updates all of the
inhibitions to reflect the current state of the tree when built with
gcc4.2

Change-Id: I7bad4fee1258f4e37fd729cda84711fed66acbc9
Reviewed-on: http://gerrit.openafs.org/813
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 09:17:56 -08:00
Simon Wilkinson
748eaf8041 Prototype kalog_Init
Prototype the kalog_Init function in kauth_internal.h, and remove
the warning inhibition from kaserver.c

Change-Id: Ic48d199126629f1c0c2e498081be97901678ec70
Reviewed-on: http://gerrit.openafs.org/812
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 09:17:35 -08:00
Simon Wilkinson
420dfad900 const char paths for ubik_ServerInit
ubik_ServerInit* take a pathname, which should really be a const.
It already is in many of the callers, some of which remove the
const by casting, the others throw errors.

Make pathName const for all of ubik_ServerInitByInfo, ubik_ServerInit
and ubik_ServerInitCommon.
Update all of our callers to remove the now unecessary casting.
Remove the now uneccessary warning inhibition on vlserver/vlserver.c

Change-Id: I009103dc49e4473eec65ebd75aab727915c26f3c
Reviewed-on: http://gerrit.openafs.org/811
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 09:17:25 -08:00
Simon Wilkinson
420a544ece Fix des key type issue in bosoprocs
The call to afsconf_AddKey was using 'akey' rather than 'akey->data'.
As data is the first element of the akey structure, these are actually
identical, but the compiler sees it as a type error. Fix to use the
correct name, and remove the warning inhibition.

Change-Id: Id4775a836276ddd6f5ae105c298dcc3c68b92145
Reviewed-on: http://gerrit.openafs.org/810
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 09:16:59 -08:00
Simon Wilkinson
be305ae119 Prototype UV_Bind
Publicly prototype UV_Bind in volser_prototypes.h

Make dump.c use the public prototype, instead of an incomplete
private copy, and remove the warning inhibition that was required to
support the private copy.

Change-Id: I945192454702d79083a10062adaf2cb124d14a35
Reviewed-on: http://gerrit.openafs.org/809
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 09:15:56 -08:00
Simon Wilkinson
bab6fd227f Remove 'M' variants of lock macros
Since the beginning, we've had M variants of the lock macros, which
are identical to the normal form. Dispose of these variants, to make
it clearer what's going on.

Change-Id: I0b7708ec670ef0edb4c1dc21d472e5041d31f6a2
Reviewed-on: http://gerrit.openafs.org/807
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 09:15:25 -08:00
Simon Wilkinson
cbe83cb1a1 Fix warnings from afsconf_SetExtendedCellInfo
If a is declared as an array, then a == &a. However, the compiler
still gives a type warning when usign the & form, as the types no
longer match. 5f720faab9 fixed this
problem for calls to GetExtendedCellInfo - do the same for the
corresponding Set calls.

Change-Id: I8204afe7df0c0db1d059cb3f6ab61eff1cdf9140
Reviewed-on: http://gerrit.openafs.org/808
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 07:37:27 -08:00
Simon Wilkinson
c90132f2af Include signal.h for sigfillset
f6ce2af008 added a call to
AFS_SIGSET_CLEAR to vol/volume.c. However, it didn't add signal.h
to this file. As AFS_SIGSET_CLEAR calls sigfillset(), this broke
checked builds.

Add signal.h to the list of headers to fix the build warning.

Change-Id: Ib861abfbd153f6ef2ff4b42ea03b5604a95975d4
Reviewed-on: http://gerrit.openafs.org/806
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 07:32:14 -08:00
Marc Dionne
d616d1ee99 krb_udp.c warning fix
This file generates a warning because the left side of a variable
assignment is commented out.  Keep the effect of the line
(incrementing packet) but remove the unused casting and
reference, and remove the comments that date from the original
IBM source.
Leave a new comment in place in case the information is useful.

Adjust the Makefile and README.WARNINGS to account for the change.

Change-Id: I944e1c488e39411d32d700cba2d3ef567eddddb4
Reviewed-on: http://gerrit.openafs.org/804
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 07:30:29 -08:00
Michael Meffie
c4dfacc934 cm: address race condition in afs_QueueVCB
Access the vcache callback member after taking
the xvcb lock to avoid the server object from
being freed in FlushServer on another thread.

Eventually, we should have a ref count on
avc->server.

FIXES 125596

Change-Id: I760819b1632d0e8188eaa34531239951aab980d3
Reviewed-on: http://gerrit.openafs.org/800
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 07:28:20 -08:00
Marc Dionne
2d0824245c src/pam/afs_auth.c warning fix
ka_UserAuthenticateGeneral expects an afs_int32 pointer for the
password_expires argument.  A (long *) was used in afs_auth.c,
generating a few warnings.

Change-Id: Iafc92e72022644ff23c642e801d51bd4387afa88
Reviewed-on: http://gerrit.openafs.org/803
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 07:24:42 -08:00
Simon Wilkinson
954f67c682 cr_gid is already used by Darwin
Commit eb8e55bba7 introduced a variety
of functions for accessing members of the credentials structure in a
platform independent way. Sadly, cr_gid is already defined by the
Darwin platform headers (on Darwin, the GID is just the first of
the user's groups)

Turn cr_gid() into afs_cr_gid() to avoid this problem, and for
consistency, also rename cr_uid, cr_ruid, cr_rgid, and the
corresponding set_* functions.

Change-Id: I82d74900324d079b5a5c8985510a2c9586c4a526
Reviewed-on: http://gerrit.openafs.org/805
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-11 07:24:21 -08:00
Derrick Brashear
fc5e2a4d81 unix srv record network byte order fix
correctly process dns lookups corresponding to the srv record changes in
network byte order

Change-Id: Id70f972331582912ca984ae1b1c027c7b702a22c
Reviewed-on: http://gerrit.openafs.org/801
Reviewed-by: Thomas L. Kula <tkula@umich.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Russ Allbery <rra@stanford.edu>
2009-11-10 11:31:45 -08:00
Russ Allbery
24de8dae6d Update afsd cache and firewall details
Cache parameters are discussed in two locations in the afsd man page,
and the first copy had not been updated for the new auto-tuning of
the chunk size and the stat parameter.  Fix both.

Note that the firewall requirements for klog only apply if you're using
kaserver and klog.  Kerberos v5 has its own requirements, but this is not
the place to talk about them.

Change-Id: I9cdaaa71351a64cecc1b6904efba87d4871d42fb
Reviewed-on: http://gerrit.openafs.org/798
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-10 08:53:38 -08:00
Simon Wilkinson
c9197a1f32 Fix locking in FlushVCBs when called from discon
The disconnected code doesn't request locking from FlushVCBs when
it calls it, but also doesn't hold the required locks itself.

Fix this.

Change-Id: I2450df4b19b2d44dca80990197e5e7637c9c8334
Reviewed-on: http://gerrit.openafs.org/802
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-10 05:03:17 -08:00
Marc Dionne
eb8e55bba7 Unix client: wrappers for credentials structure access
This patch introduces and makes use of wrappers for access
to credentials structure members:
	cr_uid (afs_ucred_t *)
	cr_ruid(afs_ucred_t *)
	cr_gid (afs_ucred_t *)
	cr_rgid(afs_ucred_t *)
	cr_group_info(afs_ucred_t *)

Inline functions are also introduced to set values:
	set_cr_uid (afs_ucred_t *, uid_t)
	set_cr_ruid(afs_ucred_t *, uid_t)
	set_cr_gid (afs_ucred_t *, gid_t)
	set_cr_rgid(afs_ucred_t *, gid_t)
	set_cr_group_info(afs_ucred_t *, struct group_info *)

This will allow an architecture to make use of an alternate
structure to hold credentials.  In particular it will allow
the linux client to be modified to use the kernel credentials
structure directly instead of shadowing it into our own local
structure.

There should be no functional change.

Change-Id: I7739196a0691a9c30887043b085e4878e88780ae
Reviewed-on: http://gerrit.openafs.org/768
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-09 08:19:06 -08:00
Michael Meffie
f6ce2af008 viced: avoid useless core if shutdown during initialization
Avoid leaving an unnecessary core file when the fileserver is
shutdown while still attaching volumes.  The bosserver issues
SIQUIT to shutdown the fileserver which leaves a core file by
default.

Register the fileserver shutdown signal handler earlier in the
fileserver initialization, before the long running volume
attachment is started. The volume package shutdown has been
changed to allow the VShutdown to gracefully abort the volume
attachment (or pre-attachment for DAFS).

FIXES 124485

Change-Id: Ic22e68afb7bcc54ad956b2ae093375f29b969191
Reviewed-on: http://gerrit.openafs.org/764
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-09 06:16:59 -08:00
Simon Wilkinson
d98d3060f8 Add printf-style format checking
Add the AFS_ATTRIBUTE_FORMAT macro which can be used to turn on
printf-like format checking for our va-arg log functions.

Enable this checking for volser's Log(), and fix the fallout from
doing so.

Change-Id: Ic5ab93ba731856f1f90e894d711b0f84298ded12
Reviewed-on: http://gerrit.openafs.org/789
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-08 08:27:16 -08:00
Simon Wilkinson
392dcf676b Complete removal of DUX client code
With commit cfce015ead (in 2006) all
of the files specific to the DUX cache manager were removed.
However, the DUX code within general files remained untouched.
This patch completes the removal of the (entirely non-functional)
DUX client, by removing all cache manager code which is for
AFS_DUX*_ENV and AFS_OSF_ENV platforms.

It also takes the advantage of this removal to simplify some #ifdef
ladders, and indents others (purely because I needed the indentation
to work out what on earth was going on!)

Change-Id: Icbea5ed3ef94c5e902cdb0d722be85f376c3d296
Reviewed-on: http://gerrit.openafs.org/785
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-08 08:26:25 -08:00
Simon Wilkinson
c90134fd1f Move vnode macros to their own directories
The tree is inconsistent whether macros for access to vnodes are
provided by the OS directories, or in afs_osi.h. This makes things
very confusing, especially in the Linux case where macros are
provided in afs_osi.h, and then promptly redefined in
LINUX/osi_machdep.h

Adopt a convention where default macros are conditionally provided
by osi_machdep.h. Where these aren't wanted, they should be disabled
in osi_machdep.h, and OS specific versions provided in the individual
OS's directory.

Change-Id: I47bc969af3f6670db9348689b5ce60181fd44f21
Reviewed-on: http://gerrit.openafs.org/784
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-08 08:25:57 -08:00
Marc Dionne
4573034400 Linux: always use afs_maybe_unlock_kernel
In one error case in afs_linux_lookup unlock_kernel() is called
directly instead of using the conditional "maybe" form.
If the config is such that the BKL is not taken, this can result
in an attempt to unlock when the lock has not been taken, and
can cause an oops.

Change-Id: I27d5db58e9b9d45d925b24e27bc43960499c6ead
Reviewed-on: http://gerrit.openafs.org/790
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-08 08:25:09 -08:00
Simon Wilkinson
09c4c1978b Add error_table.c to gitignore in comerr
error_table.c is a build product for comerr, should we should
gitignore it

Change-Id: Ie47ae4daec734b31c884e4732d053635ee1048bb
Reviewed-on: http://gerrit.openafs.org/788
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-06 20:04:27 -08:00
Andrew Deason
fd592c7674 Cleanup VOffline log message
Make the 'Volume X (Y) is now offline' messages appear more sanely in
the log; logging as one line at once.

Change-Id: I8a3cf986fb30e292e509237357bd1039f2f181b9
Reviewed-on: http://gerrit.openafs.org/782
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-05 08:01:39 -08:00
Simon Wilkinson
95770bf95a Prevent VLRUQ race in ShakeLooseVCaches
When ShakeLooseVCaches is called from afs_Daemon, the xvcache lock
is not held. This means that if the GLOCK is dropped for any reason
(for example, whilst purging the dentry cache), then
ShakeLooseVCaches can be raced, end we can end up attempting to
flush the same vcache twice.

The symptoms of this in Linux are that we oops in clear_inode.

Get the xvcache lock in afs_Daemon(), before calling
ShakeLooseVCaches. Also, remove the conditional GLOCK code from
that function. If we don't have the GLOCK on entry, then we're really
in trouble (and both code paths - afs_Daemon and afs_NewVCache should
get the GLOCK for us, anyway)

FIXES 125589

Change-Id: I3fe5b41a661cd162ec73c51492925ad87c6d4c13
Reviewed-on: http://gerrit.openafs.org/781
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-04 20:40:04 -08:00
Rainer Toebbicke
86858bdfb6 Correct diskused and files when cloning a volume
Recalculates a volume's disk space used and number of files upon
every clone where it is effortless. Even though tracked mostly
correctly, bugs and accidents leave their traces which only a
salvage would correct.

Change-Id: Ied6fb9eb3944b6e30eac175fe42649c5b7cfaefb
Reviewed-on: http://gerrit.openafs.org/756
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-04 09:39:58 -08:00
Derrick Brashear
2df6f25f61 macos fstrace msgcat search path
everything else on osx will look for config in /var/db/openafs; make
fstrace do the same

Change-Id: I7b787435343b15c82cd8eb8f3ed00096d469e888
Reviewed-on: http://gerrit.openafs.org/772
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-04 05:30:18 -08:00
Derrick Brashear
848b781d11 macos 10.6 64bit trace fixes
the 64 bit pointer massaging was incomplete for kernel
tracing on macos. add in the missing cases.

Change-Id: I38eb608c233819ab437adec25e2cd3afac3e234e
Reviewed-on: http://gerrit.openafs.org/771
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-04 05:21:13 -08:00
Marc Dionne
c41d3b2132 Linux - Fix disk cache access for selinux/AppArmor constrained processes
Preserve the credentials used for cache initialisation and use then
whenever disk cache files are opened.  This takes advantage of the
credentials separation work from David Howells available in kernels
2.6.29 and above.
Access to cache files was done under the security context of the
user process, causing processes constrained by selinux or AppArmor to
fail to access AFS cache files and causing the cache manager to panic.

Besides the RT tickets, should also fix the following Ubuntu bugs:
 415766 429260 457779 459299

FIXES 92944,125544

Change-Id: Ief8acd65c1a3e4d8c951f80bfd65f8340b8cec34
Reviewed-on: http://gerrit.openafs.org/752
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
2009-11-03 17:47:39 -08:00
Jeffrey Altman
cbe580fee1 Check for (hostFlags & HOSTDELETED) after h_Lock_r
Many callers of h_Lock_r do not check if the HOSTDELETED flag is set,
even though it could have been set while waiting for the host lock. Add
checks for it everywhere we call h_Lock_r and we care if the host has
been deleted.

FIXES 125507

Change-Id: Id1430529a1afdb5e2af29d40148877f5e4260a41
Reviewed-on: http://gerrit.openafs.org/716
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-03 12:08:43 -08:00
Andrew Deason
f08c714f88 DAFS: Avoid SALVSYNC communication during shutdown
Avoid trying to contact the salvageserver for any reason while we are
shutting down. During shutdown the salvageserver may not be around
anymore, so any SALVSYNC communication will appear to hang.

Just set a global flag to indicate 'no-SALVSYNC' on shutdown, in
addition to the thread-local flag we already have.

Change-Id: Id96f20917fd0753b4934a0377b91032b2ea3d0dc
Reviewed-on: http://gerrit.openafs.org/765
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-03 11:42:32 -08:00
Andrew Deason
5e6842283f DAFS: Wait for exclusive ops in FSYNC_VOL_OFF
In the FSYNC_VOL_OFF handler, fssync-server.c errors out if the call to
VGetVolumeByVp_r fails. However, this can fail if the volume is in an
error state such as SALVAGING. Normally we don't even call GetVolume
when the volume is salvaging, but the volume state can change to
SALVAGING inside GetVolume. This is particularly likely to happen on a
demand salvage, since we switch to the SALVSYNC_REQ state when
scheduling the salvage, and if we are still in that state when the
salvaged child requests a VOL_OFF, we will fail to get the heavyweight
ref.

Fix this in two ways. First, we VWaitExclusiveState_r before examining
states for the short-circuit logic so our view of the volume state is
more accurate. Second, re-examine the volume state after the call to
GetVolume, and perform the same short-circuit logic, since the volume
state may have changed during GetVolume.

Change-Id: I4ebb87691c28170b42e0056b342477a12d0f6888
Reviewed-on: http://gerrit.openafs.org/769
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-03 11:40:58 -08:00
Dan Hyde
93d48b1735 Add array bounds checking in h_Enumerate
When hostList is not properly NULL-terminated, the current code does
not protect from buffer overflow.  The following patch prevents buffer
overflow, prints a message, and asserts.

On our Linux hosts, we never reached the original assert, as there is
a problem handling the segfault the buffer overflow causes.

FIXES 125506

Change-Id: Ifce92c593d17050e45add9e37a7a9ed4fbc377ef
Reviewed-on: http://gerrit.openafs.org/757
Reviewed-by: Dan Hyde <drh@umich.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-02 14:29:06 -08:00
Marc Dionne
715c67f2fb Linux: Fix write_begin configure test for recent RHEL kernels
Recent RHEL kernels now define simple_write_begin, which was used as
a test for the write_begin address_space op.  This makes the test
succeed when it shouldn't, and breaks the build.
Rewrite the test to actually check the address_space operation.

Change-Id: Idac9b318ff716b61bf8ca4508d2dbdbfbad5b50d
Reviewed-on: http://gerrit.openafs.org/759
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-11-02 04:43:42 -08:00
Marc Dionne
5a537f0719 Fix memory allocation warnings at shutdown
At shutdown we check for unfreed memory allocated with AllocSmallSpace
and AllocLargeSpace and complain in the syslog if there are dangling
pieces.  This patch takes care of a few cases that always showed up
as warnings, even after a simple start-stop of the client.

- The cacheInode file needs to be closed before the checks, since it
uses a large piece for its struct file.

- The ICL logging code allocates 6 small pieces that are never freed.
Add a shutdown_icl() function that releases everything.  While we're
at it, correct one place where we allocated with afs_osi_Alloc but
freed with osi_FreeSmallSpace, confusing our accounting.

Change-Id: I4c28c848f155dec9d89e6199cde34209227ca5c9
Reviewed-on: http://gerrit.openafs.org/758
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-11-02 04:43:02 -08:00
Marc Dionne
8b3d2c1a3c Linux: remove unused cr->next member in struct afs_cred
This field was once used to track allocations in a credentials pool.
That code was removed a few years ago but the field remained.

Change-Id: Ieac642d7d55c4da766a5a3aa8ff790a514b606d6
Reviewed-on: http://gerrit.openafs.org/753
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Dan Hyde <drh@umich.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2009-10-30 05:22:22 -07:00
Simon Wilkinson
afdfbefe9c Cleanup cache bypass
This patch cleans up the cache bypass code so that it uses a
consistent form of indentation throughout the file.

It also changes the do { } while(0); macros to omit the trailing
semicolon, as macro definitions with trailing semicolons break
normal coding conventions.

Change-Id: Id5161fe4b1ba27110e41ed27e14a2bb3c9cccd4a
Reviewed-on: http://gerrit.openafs.org/754
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-10-29 15:23:22 -07:00
Andrew Deason
416e2f11c3 Avoid using released hosts
Since h_Release_r has the possibility of freeing a host, we should not
be using a host after it has been released. A few places can still use a
released host, potentially causing heap corruption, double frees, and
generally weird behavior.

So either move calls of h_Release_r until after we finish using a host,
or make sure to set the pointer to NULL after it has been released.

Change-Id: I3d5275c3862003e372d3c19a5462e62bf9cb269e
Reviewed-on: http://gerrit.openafs.org/747
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Dan Hyde <drh@umich.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-10-29 13:01:49 -07:00
Simon Wilkinson
28ccbd1ad8 Coding style cleanup
Our style for function definitions has the name of the function as
the first item on a new line - this means you can find a definition
by using grep ^functionName. Fix the disconnected code to follow this
style.

Change-Id: I925039070f2bbbd97f04fbee006ea08df92d7cf5
Reviewed-on: http://gerrit.openafs.org/751
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2009-10-29 12:57:01 -07:00