afs: clarify cold and warm shutdown logic Currently, any code that wants to perform a cold shutdown must first set global afs_cold_shutdown = 1, then call afs_shutdown(void). Instead, modify afs_shutdown() to accept a single parm which specifies AFS_WARM or AFS_COLD shutdown, and to set the value of global afs_cold_shutdown based on this parm. Remove all other assignments for afs_cold_shutdown. Modify all callers of afs_shutdown() to specify AFS_WARM or AFS_COLD as needed to maintain equivalent function. This should make it much easier to tell at a glance what type of shutdown is being requested by each caller to afs_shutdown(). No functional change should be incurred by this commit. Change-Id: I921eca5b4d2659209154fbe37d575db69bf708b8 Reviewed-on: https://gerrit.openafs.org/12182 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
afs: Avoid using logical OR when setting f_fsid Building with clang-10 produces the warning/error message warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare] for the expression abp->f_fsid = (AFS_VFSMAGIC << 16) || AFS_VFSFSID; The message is because a logical OR '||' is used instead of a bitwise OR '|'. The result of this expression will always set the f_fsid member to a 1 and not the intended value of AFS_VFSMAGIC combined with AFS_VFSFSID. Update the expression to use a bitwise OR instead of the logical OR. Note: This will change value stored in the f_fsid that is returned from statfs. Using a logical OR has existed since OpenAFS 1.0 for hpux/solaris and in UKERNEL since OpenAFS 1.5 with the commit 'UKERNEL: add uafs_statvfs' b822971a. Change-Id: I3e85ba48058ac68e3e3ac7f277623f660187926c Reviewed-on: https://gerrit.openafs.org/14292 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
afs: Remove useless afs_GetVCache arguments The 'avc' argument in afs_GetVCache has never been used, all the way back to OpenAFS 1.0. The 'cached' argument was set correctly, but none of its callers ever looked at the result of 'cached'. Remove these useless arguments. afs_LookupVCache and afs_GetRootVCache also had the same 'cached' argument, which was also never used by callers. Remove it for those, as well. Change-Id: I3536259f26536acc02fbb058787f417bf0f50b9a Reviewed-on: https://gerrit.openafs.org/13681 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
afs: Stop abusing ENOENT When looking up a file, the ENOENT error code is supposed to be used if we know that the target filename does not exist. That is, the situation is a user or application error; they specified a filename that was not previously created. Currently, though, we use ENOENT for a variety of different situations, such as: - After successfully looking up a directory entry, we fail to afs_GetDCache or afs_GetVCache on the FID for that entry. - We encounter an invalid mount point, in certain code paths. In each of these situations, an ENOENT error code is incorrect, since the target filename does indeed exist and these situations may be caused by network or administrative errors. An ENOENT error implies that the user may be able to then create the target filename, which is not true most of the time in the above situations. In addition, on LINUX we return a negative dcache entry when we encounter an ENOENT error on lookup. This means that if any of the above scenarios occur, Linux would cache the fact that that directory entry did not exist, and return ENOENT for future lookups. This was worked around in one of the changes in commit 652f3bd9cb7a5d7833a760ba50ef7c2c67214bba to always invalidate such negative dentries, but at the cost of performance (since this caused negative lookups to never be cached). To avoid all of these issues, just don't use ENOENT in these situations. For simple non-disconnected afs_GetDCache or afs_GetVCache errors, return EIO, since we have encountered an error that is internal to AFS (either the underlying data is inconsistent, or we have a network error, or something else). In disconnected operation, return ENETDOWN like in other disconnected code paths, since often the root cause is due to us not having network access. When a bad mountpoint is encountered, return ENODEV, since that is what we use elsewhere in the code when encountering a bad mountpoint. It is also noteworthy that this changes removes the translation of VNOVNODE into ENOENT, since a nonexistent vnode is not the same as a nonexistent filename, as described above. Some code paths have special behavior for this situation (ignoring the error in some cases where it does not matter). These code paths should be okay with this change, since all of them examine error codes that have not been translated through afs_CheckCode. Some useless references to ENOENT were also removed in src/afs/LINUX*/osi_misc.c. These did not result in incorrect behavior, but removing them makes searching for bad ENOENT references easier. Change-Id: Ib01e4309e44b532f843d53c8de2eae613e397bf6 Reviewed-on: http://gerrit.openafs.org/11788 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
afs: Raise fake free space reporting We report 'fake' values for free space, free file nodes, etc for the 'AFS' filesystem, since these values are not meaningful for AFS itself. Currently we report about 9G of free space for most platforms, and a few different values for a few others. Raise all of these to 2^32-1, so that trying to copy over 9G of data into AFS does not fail for those applications that check the destination free space with statfs(2). Note that one such application is KDE 4.8.x. Consolidate all places that do this, and put the 'fake' value in one place, AFS_VFS_FAKEFREE, along with the relevant comments. Related issues reported by Lars Schimmer, Richard Brittain, and others. Change-Id: Ia15175da32744e11f62489c29bedfe1f5560d2b4 Reviewed-on: http://gerrit.openafs.org/9688 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Markus Koeberl <markus.koeberl@tugraz.at> Tested-by: Markus Koeberl <markus.koeberl@tugraz.at> Reviewed-by: D Brashear <shadow@your-file-system.com>
UKERNEL: f_fsid is a struct on AIX The statvfs f_fsid member is a struct with two fields on AIX when _ALL_SOURCE is defined (which we define to get various extensions). So in the AIX case, use it as such a struct instead of a single integer. Change-Id: Ibd94d6b38b0cdc08b5812fe29e4e93344765ff05 Reviewed-on: http://gerrit.openafs.org/3260 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
death to register in soviet compilers, compiler optimizes you. stop providing dated (and annoying for debugging) register keywords. Change-Id: Ibcac0aa3f353fe531b9be0beedca919fb947bfab Reviewed-on: http://gerrit.openafs.org/2436 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
ukernel osi prototypes header and add statvfs to it so we stop getting a warning Change-Id: I585f559f083203214d298062862434f9f381808b Reviewed-on: http://gerrit.openafs.org/1729 Tested-by: Derrick Brashear <shadow@dementia.org> Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementia.org>
UKERNEL: add uafs_statvfs Change-Id: Iedd7882f4a57cd89d145f1c61c5f85181187db03 Reviewed-on: http://gerrit.openafs.org/1716 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
UKERNEL: End the #define u insanity UKERNEL redefines the character 'u' to do a function call. This hurts other kernel developers in all sorts of interesting ways. Remove the definition, and instead explicitly reference the get_user_struct() function in those places that we need to. Change-Id: I64be2eb527c779df0a3d4508444ed68f3634667d Reviewed-on: http://gerrit.openafs.org/1243 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
Use intptr_t and uintptr_t for integer/pointer conversions Use intptr_t and uintptr_t casts to appease the compiler when values are converted between 32-bit integers and pointers. This generates many warnings (currently ~170 on linux amd64) when pointers are 64-bit. These types are normally defined in stdint.h, and get defined by autoconf if that's not the case. In a few places, NULL is simply replaced with 0 where compared with an integer. Reviewed-on: http://gerrit.openafs.org/474 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
Fix UKERNEL afs_mount arguments Change 73 (commit dc6299f5) changed the order of arguments for the UKERNEL implementation of afs_mount, causing uafs_mount to segfault whenever called. This changes them back to what they were before. Reviewed-on: http://gerrit.openafs.org/256 Tested-by: Derrick Brashear <shadow@dementia.org> Reviewed-by: Derrick Brashear <shadow@dementia.org>
Ukernel prototypes Prototypes and warning fixes for the cache manager when built as part of libuafs Reviewed-on: http://gerrit.openafs.org/73 Verified-by: Derrick Brashear <shadow@dementia.org> Reviewed-by: Derrick Brashear <shadow@dementia.org>
Remove the RCSID macro The move to git means that we can no longer populate the RCSID macro in the way that it was used with CVS. This patch simply removes the macro from every file, except where it contains information from upstream (and it's in a comment). Reviewed-on: http://gerrit.openafs.org/14 Verified-by: Derrick Brashear <shadow@dementia.org> Reviewed-by: Derrick Brashear <shadow@dementia.org>
discon-allow-saving-vcaches-on-shutdown-20090126 LICENSE IPL10 FIXES 124211 restructure so we can save info necessary to keep dirty changes across offline shutdown
fix-indent-bug-with-lock-macros-part-three-20040818 Add trailing semicolons to more macros and re-indent.
reindent-20030715 FIXES 1774 thanks to nneul@umr.edu for providing a script to do this. gnu indent 2.2.9 options: -npro -nbad -bap -nbc -bbo -br -ce -cdw -brs -ncdb -cp1 -ncs -di2 -ndj -nfc1 -nfca -i4 -lp -npcs -nprs -psl -sc -nsob -ts8 ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== FIXES 1774 fix subst mistake
no-copy-libafs-builds-20021015 make things so file copies from src/libafs don't happen; change how libafs_tree is done
pull-prototypes-to-head-20020821 pull up prototypes to head
Fix a vcache refcount leak in afs_root() on all platforms.