Remove dead code There is a perhaps-surprisingly large amount of code disabled behind directives like '#if 0', '#ifdef notdef', and '#ifdef notyet'. At best, this code is clutter, and at worst some of it is confusing/outdated, and/or confusingly nested inside other preprocessor conditionals. Sometimes this disabled code shows up when grepping the tree, and causes a nuisance when refactoring related areas of code. Get rid of all of it. If anyone ever wants this code back, it can always be restored by reverting portions of this commit. Also delete some comments that clearly refer to the disabled code, and in some cases, adjust the adjacent comments to make sense accordingly. This commit doesn't touch any files in src/external/. Change-Id: If260a41257e8d107930bd3c177eddb8ab336f0d1 Reviewed-on: https://gerrit.openafs.org/13683 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Windows: CM_ERROR_INEXACT_MATCH is not a fatal error cm_BPlusDirLookup() and cm_Lookup() can return CM_ERROR_INEXACT_MATCH which is not a fatal error. Instead it is an indication that the returned cm_scache object was not a case sensitive match. Do not fail the request and do not leak the cm_scache reference. Change-Id: Ieef3ce1ac96a8794859b5b9c530545d4fdd26bd5 Reviewed-on: http://gerrit.openafs.org/12057 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: rdr pioctl operations are opaque Although pioctl operations are delivered through the redirector the contents of the operations are opaque to the redirector. Therefore, the cm_req must not be initialized as a redirector operation. If they are the necessary invalidation notifications for symlink and mount point operations will not be delivered. Change-Id: I48c2d89d2b2e0fc3f0ef56e7731108a8c51e1674 Reviewed-on: http://gerrit.openafs.org/12062 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: Fake status info on EACCES When enumerating a directory if status info for an entry cannot be obtained, fake it. Do not return STATUS_ACCESS_DENIED to the redirector as that will be interpreted as the directory not being listable. Change-Id: I488f5d8d244c363135e00e156a685cd56fd060c8 Reviewed-on: http://gerrit.openafs.org/11736 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Perry Ruiter <pruiter@sinenomine.net> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: foo.backup -> foo.backup too many symlinks In the case where an explicit mount point to a .backup volume is resolved from a .backup volume the cache manager refuses to evaluate the mount point target. This is meant to address unwanted recursion in the directory tree searches. Change the error code to ERROR_TOO_MANY_SYMLINKS and propagate that error to the AFS redirector. That will result in the application receiving STATUS_ACCESS_DENIED instead of STATUS_REPARSE_POINT_NOT_RESOLVED. The STATUS_REPARSE_POINT_NOT_RESOLVED error causes cmd.exe and powershell.exe to terminate recursive directory searches. Change-Id: I5dfdd835e8696b823af45a8e5c33a5ca6320cf31 Reviewed-on: http://gerrit.openafs.org/11693 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: report AllocationSize in 1KB increments Windows expects storage to be allocated in increments of some block size. The AFS servers allocate in 1K units so lets report that to Windows. Change-Id: I64ad1844339357733933cd9e360551fdcd450146 Reviewed-on: http://gerrit.openafs.org/11490 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: Do not sync callbacks when only need locks 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>
Windows: Deny writes/truncation to files w RO attr If the readonly file attribute is set on a file, refuse to process writes, truncations or overwrites. The afsd_service will do so and this can lead to data corruption. At the same time, writes from the redirector to afsd_service must not be denied because of the readonly attribute. That check was performed during the CreateFile. Otherwise, a new file can be created with the readonly attribute and then not be writable. Change-Id: I921a11eb8c1a3e642d60c23fc905b3febc0f0761 Reviewed-on: http://gerrit.openafs.org/10985 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: RDR_EvaluateNodeByName out of order param The bHoldFid parameter is after the bNoFollow parameter. The two values were swapped resulting in unnecessary VLDB lookups. Change-Id: Ia94bd761576d54e9dde847385a4900f2d915c34d Reviewed-on: http://gerrit.openafs.org/10636 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: RXAFS_GetVolumeStatus no PRSFS_READ check Since d2d591caf2c9b4cf2ebae708cc9b4c8b78ca5a5a the file server no longer performs a PRSFS_READ access check for the GetVolumeStatus RPC. The cache manager should no longer test for PRSFS_READ as a means of avoiding RPCs that are known to fail. Change-Id: I67bd849d337d87657db8e1f0ed2839367b7972a8 Reviewed-on: http://gerrit.openafs.org/10532 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: cm_FindVolumeByFID cm_GetVolumeByFID() does not query the vldb if the volume group is not known to the cache manager. cm_FindVolumeByFID() is to be used in cases where the volume group data must be known for the operation to successfully complete. Change-Id: I9bb3bd13f14dea534952495b00a3348aafd2d591 Reviewed-on: http://gerrit.openafs.org/10465 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: Uninitialized TargetNameLength/Offset In RDR_PopulateCurrentEntry it is possible for TargetNameLength and TargetNameOffset to be uninitialized resulting in stack garbage being returned to the redirector. This can result in a blue screen. Change-Id: Ifa306ba54bea3f26f1938cbd6bdc28521065299d Reviewed-on: http://gerrit.openafs.org/10373 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: Delay MP Target evaluation until required Do not evaluate the Target FID of a mount point until such time as the target directory must be accessed. Change-Id: I8aa0da50256cacc4433fad6c7675ca8bd3bd5eb7 Reviewed-on: http://gerrit.openafs.org/10154 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: modify PopulateCurrentEntry follow mp rules It is always safe to read the mount point target data, it is not always safe to evaluate the volume id since the VLDB might not be reachable. For directory enumerations do not evaluate the target Fid. Only do so for eval by name and by id requests. Change-Id: Ifa0e84b2e9fb0822dceb9d719a47c541fed2a2bf Reviewed-on: http://gerrit.openafs.org/10153 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: RDR_GetVolumeInfo do not always return success If the call failed because all servers are down or all instances of the volume are offline or busy, tell the caller. Do not return fake data. Change-Id: I4e89cefba19161c7d75cfdfd04a1cf7dfc2398f4 Reviewed-on: http://gerrit.openafs.org/9882 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com> Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: "ReparsePointPolicy" registry key HKLM\SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters DWORD "ReparsePointPolicy" Valid values are: 0 - No global policy set 1 - Reparse Points to Files treated as the target File Change-Id: Ib8f4f6a4c5c3b2faaf86a6650a4ce3ebcbbdf0e0 Reviewed-on: http://gerrit.openafs.org/9789 Reviewed-by: Peter Scott <pscott@kerneldrivers.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com> Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: Report Case Sensitive Search Return the FILE_CASE_SENSITIVE_SEARCH volume flag as part of afs volume properties. NTFS does and our search algorithm is case sensitive first, then case insensitive. Change-Id: I64857cdf8712847064c8271956cebe2bdbe487df Reviewed-on: http://gerrit.openafs.org/9850 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: RDR_DeleteFileEntry test for empty directory RDR_DeleteFileEntry should check to see that a directory entry that is a directory is in fact empty. The most frequent use of RDR_DeleteFileEntry is to check whether the object can be deleted prior to setting the DeletePending state which in turn results in the object being deleted during Cleanup. If the directory is not empty during Cleanup it is too late for the error to be seen by the application. Change-Id: I3207bab0527406e3003e97bccf4195abeed31423 Reviewed-on: http://gerrit.openafs.org/9779 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: cache readonly volume size information Cache the volume size information for .readonly volumes which can be reset when the volume callback is broken. This reduces the number of RXAFS_GetVolumeStatus RPC calls issues on .readonly volumes. Change-Id: Ie0e63ca9082a004da71098e28df1315d42d364ff Reviewed-on: http://gerrit.openafs.org/9681 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com> Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: File Attribute Reporting Consistency Do a better job of consistently reporting file attribute information via directory queries and file information queries. Avoid computing file attribute information for file information queries that do not return them (e.g., Name Information) because computing it is expensive. Change-Id: I5c8120698261f555edfa98e92230705b593aca36 Reviewed-on: http://gerrit.openafs.org/9613 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com> Tested-by: Jeffrey Altman <jaltman@your-file-system.com>