openafs.git
8 years agobucoord: Remove dead assignments in cmd init
Simon Wilkinson [Mon, 25 Feb 2013 10:32:22 +0000]
bucoord: Remove dead assignments in cmd init

Don't assign command syntax objects to 'ts' if we're not going
to add any parameters to them

Change-Id: I69f6e090fc115ab213c1f20dc46da81f2878e0a3
Reviewed-on: http://gerrit.openafs.org/9260
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agobutc: Remove dead initialisation
Simon Wilkinson [Mon, 25 Feb 2013 10:28:31 +0000]
butc: Remove dead initialisation

The 'bytesread' variable is set by all code paths, so don't bother
assigning a default value each time we pass through the loop

Caught by clang-analyzer

Change-Id: I8b79bc888ba23e2bcfa9befb5bf034db8f3ca3f8
Reviewed-on: http://gerrit.openafs.org/9259
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovolser: Don't catch errors in cleanup
Simon Wilkinson [Mon, 25 Feb 2013 10:26:33 +0000]
volser: Don't catch errors in cleanup

We can't do anything if cleaning up the clone volume fails, so
don't bother storing the error code.

Caught by clang-analyzer

Change-Id: I5249dbad9a1bb732aba73e7a09f74c83e606b45d
Reviewed-on: http://gerrit.openafs.org/9258
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agobucoord: Remove dead initialisation
Simon Wilkinson [Mon, 25 Feb 2013 10:24:53 +0000]
bucoord: Remove dead initialisation

matchLength is set regardless of what the separator is, so we don't need
to provide a default value.

Caught by clang-analyzer

Change-Id: Iac8fe8db8832cf2b3347ec1bdacc7245bddf542b
Reviewed-on: http://gerrit.openafs.org/9257
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agobutc: Remove dead initialisation
Simon Wilkinson [Mon, 25 Feb 2013 10:15:10 +0000]
butc: Remove dead initialisation

code is set to a real value on every code path, so don't bother
initialising it to 0 midway through the function.

Change-Id: I334286f2ae854c57df781af8df78e5a1bf8e9b2b
Reviewed-on: http://gerrit.openafs.org/9256
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovolser: Remove redundant success flag
Simon Wilkinson [Sun, 24 Feb 2013 13:05:13 +0000]
volser: Remove redundant success flag

In UV_RestoreVolume2, there is a success flag whose only use is ...

   success = 0
   [ ... ]
   success = 1
   if (success) {
      [ ... ]
   }

It's pointless, so just remove it, and one clang warning

Caught by clang-analyzer

Change-Id: I7d57531c4dfb8955b813d534ad3b72b182fdbc76
Reviewed-on: http://gerrit.openafs.org/9255
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agobudb: Don't double initialise iterator
Simon Wilkinson [Sun, 24 Feb 2013 13:02:19 +0000]
budb: Don't double initialise iterator

The blockaddr iterator is initialised as part of the for loop.
Don't also initialise it immediately before.

Caught by clang-analyzer

Change-Id: I97e7ced15fe204b3b2d797abbdce8b3f9a2b0c8d
Reviewed-on: http://gerrit.openafs.org/9253
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agobudb: Store dumper information correctly
Simon Wilkinson [Sun, 24 Feb 2013 12:53:59 +0000]
budb: Store dumper information correctly

Change f498c18a6f7300eb89ca3b9d9b85c4d461fa8474 attempted to fix
a problem with using an inappropriate function to copy the
ktc_principal value 'principal' into the d.dumper structure element.

Originally the code read:
    principal_hton(&principal, &d.dumper)

which copies the 'host' principal principal into the 'net' structure
d.dumper. However, this was changed to
    principal = d.dumper

Which populates 'principal' with whatever garbage is in the d.dumper
structure.

Fix this so that the assignment is done the right way around.

Caught by clang-analyzer

Change-Id: Id9865a36b5a9351d013c695ed301b627ddc4a915
Reviewed-on: http://gerrit.openafs.org/9252
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agobudb: Simplify scanHashTableBlock
Simon Wilkinson [Sun, 24 Feb 2013 12:43:27 +0000]
budb: Simplify scanHashTableBlock

We don't need to maintain two copies (entryAddr and nextEntryAddr)
of the entry address - rework the while loop so we just use one,
and make clang a little happier

Caught by clang-analyzer

Change-Id: I6f5d76e114ad09a4fd3fc36b4d64f63daa9e1e78
Reviewed-on: http://gerrit.openafs.org/9251
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agoviced: Unused sentinel in h_stateVerifyUuuidHash
Simon Wilkinson [Sun, 24 Feb 2013 12:36:02 +0000]
viced: Unused sentinel in h_stateVerifyUuuidHash

The 'found' sentinel in h_stateVerifyUuidHash is unused, because
as soon as we set it, we jump out to the 'done' label. Simplify the
function's logic, and remove a static analysis warning, by just
removing the variable.

Caught by clang-analyzer

Change-Id: I02e5ccf857f5d84cd24975b7a1b9d516624ecd64
Reviewed-on: http://gerrit.openafs.org/9250
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agobucoord: Remove dead initialisation
Simon Wilkinson [Sun, 24 Feb 2013 10:48:14 +0000]
bucoord: Remove dead initialisation

offset is simply used as a copy of nextOffset for the GetText
function call. We don't need to initialise it to 0 at the start of
the loop (and arguably, as it is passed to the function by value,
we could just remove the copy entirely)

Caught by clang-analyzer

Change-Id: I137ea3ba1ff44d94b90287d9735db69d6ff8717d
Reviewed-on: http://gerrit.openafs.org/9249
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agobutc: Remove dead assignment
Simon Wilkinson [Sun, 24 Feb 2013 10:45:41 +0000]
butc: Remove dead assignment

We never use the value of mvFlag once the string has been restored,
so don't bother reseting it.

Caught by clang-analyzer

Change-Id: I12db6957c9b8ec3bb9c43f10d9e9754d4afa3ed7
Reviewed-on: http://gerrit.openafs.org/9248
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agobudb: Fail if afsconf_GetExtendedCellInfo does
Simon Wilkinson [Sun, 24 Feb 2013 10:43:52 +0000]
budb: Fail if afsconf_GetExtendedCellInfo does

Rather than silently ignoring the failure of
afsconf_GetExtendedCellInfo, and then using garbage cell
configuration, just fail to start if afsconf can't parse the
config directory.

Change-Id: Ib3d26bc67844de10f7eb8c2ef555c5e607e4bf61
Reviewed-on: http://gerrit.openafs.org/9247
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agovolser: Remove dead assignment
Simon Wilkinson [Sun, 24 Feb 2013 10:42:00 +0000]
volser: Remove dead assignment

Don't initialise code immediately before we assign a real value
to it various UV_ functions

Caught by clang-analyzer

Change-Id: I91d9300715d44fafd73b1a61be548589468e3209
Reviewed-on: http://gerrit.openafs.org/9246
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agobutc: Catch failures to start keep alive thread
Simon Wilkinson [Sun, 24 Feb 2013 10:39:53 +0000]
butc: Catch failures to start keep alive thread

If we can't start the keep alive thread, in either the LWP or
pthread versions of a code, report an error and exit instead of
carrying on regardless.

Caught by clang-analyzer

Change-Id: I0a25a236aadeedf10d3c0c129d716b1397c9a4e3
Reviewed-on: http://gerrit.openafs.org/9245
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agobutc: Remove dead loop pointer allocations
Simon Wilkinson [Sun, 24 Feb 2013 10:36:57 +0000]
butc: Remove dead loop pointer allocations

All of these *Ptr values are reset upon each iteration of the
while loop, so we don't need to NULL them immediately before
we go around again.

Caught by clang-analyzer

Change-Id: Iaa5ff6c7b154072e23eae272031919b424568eff
Reviewed-on: http://gerrit.openafs.org/9244
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agoWindows: Test NameArrayReferenceCount before deletion
Jeffrey Altman [Mon, 25 Feb 2013 05:17:46 +0000]
Windows: Test NameArrayReferenceCount before deletion

In commit c753d398f2005c886932f20b49af15efc489a829 the
AFSDirectoryCB.DirOpenReferenceCount was split and the
NameArrayReferenceCount field was added.  However, it failed to modify all
of the DirOpenReferenceCount checks prior to calling AFSDeleteDirEntry()
to include a check on the NameArrayReferenceCount.  This patchset corrects
that oversight.

Change-Id: I8db1a68e5240088bcfeb226bd1eafac0c83a0b69
Reviewed-on: http://gerrit.openafs.org/9254
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agokauth: realm can't be NULL when calling CellToRealm
Simon Wilkinson [Tue, 19 Feb 2013 15:25:12 +0000]
kauth: realm can't be NULL when calling CellToRealm

Despite what the static analyzer thinks, ka_CellToRealm can't be
called with a NULL realm. Just add an assert to close down that
code path, and stop it from producing an error.

Change-Id: Ifc8cf7e5dca5ae29eaaa91c5b238a97197d89ee3
Reviewed-on: http://gerrit.openafs.org/9174
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: no side effects from AFSDbgLogMsg calls
Jeffrey Altman [Sun, 24 Feb 2013 19:01:28 +0000]
Windows: no side effects from AFSDbgLogMsg calls

Do not perform assignments or call side-effect resulting functions
as parameters to AFSDbgLogMsg.

Change-Id: I76eca3a82377543f4148d03af51a07886127b385
Reviewed-on: http://gerrit.openafs.org/9242
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoviced: Allow GetCapabilities to return an error
Simon Wilkinson [Fri, 22 Feb 2013 10:23:43 +0000]
viced: Allow GetCapabilities to return an error

At the moment, the GetCapabilities RPC handler ignors errors from
CallPreamble or CallPostamble. Instead of silently swallowing these,
and potentially reutnring a bogus capabilities structure, make
it possible for the RPC to return failure to the caller.

Caught by clang-analyzer

Change-Id: Ic36e59e8cce8be4920f041a86d5636d54668d887
Reviewed-on: http://gerrit.openafs.org/9241
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoviced: Catch GetCellInfo failure
Simon Wilkinson [Fri, 22 Feb 2013 10:20:58 +0000]
viced: Catch GetCellInfo failure

If GetCellInfo returns a non-zero result, catch the error, rather
than just carrying on regardless.

Caught by clang-analyzer

Change-Id: I6b9ca91c8cea2ff0d68873913abdc0daadcc0e27
Reviewed-on: http://gerrit.openafs.org/9240
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoviced: Don't store rc from IH_DEC on error path
Simon Wilkinson [Fri, 22 Feb 2013 10:16:10 +0000]
viced: Don't store rc from IH_DEC on error path

If CopyOnWrite has already failed, and is taking the volume offline
for salvage we can't (and don't) do anything with further errors from
IH_DEC. Instead of assigning these to 'rc', just ignore them.

Caught by clang-analyzer

Change-Id: I7bcd82f124740e3ca3d11cb2b079aa7ea5751cf9
Reviewed-on: http://gerrit.openafs.org/9239
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoscout: Fix a lot of dead assignments
Simon Wilkinson [Fri, 22 Feb 2013 10:09:39 +0000]
scout: Fix a lot of dead assignments

In lots of places scout takes the return value of a graphics
function, then decides it doesn't actually care about the result.

Get rid of the assignments, as they provide a false sense of
security.

Caught by clang-analyzer

Change-Id: I1ea8514b969777f1276b4e8f8ab946a4d36a870c
Reviewed-on: http://gerrit.openafs.org/9238
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agogtx: Return failure if gtx_Init can't start thread
Simon Wilkinson [Fri, 22 Feb 2013 10:35:48 +0000]
gtx: Return failure if gtx_Init can't start thread

If LWP_CreateProcess fails in gtx_Init return NULL, rather than
silently swallowing the failure.

Caught by clang-analyzer

Change-Id: I5db5667f9dae3f405e88cf9c57e6b8a069ea28a3
Reviewed-on: http://gerrit.openafs.org/9236
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoafsmonitor: Allow CBSTATS collection to work
Simon Wilkinson [Fri, 22 Feb 2013 10:30:56 +0000]
afsmonitor: Allow CBSTATS collection to work

The switch which selects the collection number was missing a
'break', so selecting the CBSTATS collection would always fall
through to the default, error, case.

Caught by clang-analyzer

Change-Id: I354873d711c5f49ddad51f1b9fb332af91a6d13a
Reviewed-on: http://gerrit.openafs.org/9235
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agobosserver: Don't store result when renaming core file
Simon Wilkinson [Thu, 21 Feb 2013 21:57:56 +0000]
bosserver: Don't store result when renaming core file

The bosserver doesn't do anything if the core file rename fails, so
don't bother storing the result code.

Caught by clang-analyzer

Change-Id: I9b1b7d77404b0fd560c7735646e5afe1fbcc0752
Reviewed-on: http://gerrit.openafs.org/9232
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agobosserver: Remove dead assignment
Simon Wilkinson [Thu, 21 Feb 2013 21:44:43 +0000]
bosserver: Remove dead assignment

In the Restart RPC handler, don't assign a value to code
immediately before we use it to hold the return value of
bozo_WaitStatus.

Caught by clang-analyzer

Change-Id: I0781c57c87088cb3ba6170ca1e5c8d5053cf9001
Reviewed-on: http://gerrit.openafs.org/9231
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agobosserver: Remove dead assignment in SaveOldFiles
Simon Wilkinson [Thu, 21 Feb 2013 20:53:02 +0000]
bosserver: Remove dead assignment in SaveOldFiles

We don't care about whether the renames succeed in SaveOldFiles,
so don't bother assigning their results to a variable

Caught by clang-analyzer

Change-Id: I0605fc71d243ef0f587706f9f3856aa4d722fb82
Reviewed-on: http://gerrit.openafs.org/9207
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoUnix CM: Remove dead assignment in readdir
Simon Wilkinson [Thu, 21 Feb 2013 20:50:07 +0000]
Unix CM: Remove dead assignment in readdir

len is zeroed at the start of the next block, so don't bother assigning
tlen to it if we're not going to do anything with it.

Caught by clang-analyzer

Change-Id: Ie1cd5a4d9dd96920018f054b6edfc18c569c9807
Reviewed-on: http://gerrit.openafs.org/9206
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agolibadmin: Fix a lot of dead assignments in vsprocs
Simon Wilkinson [Thu, 21 Feb 2013 20:36:19 +0000]
libadmin: Fix a lot of dead assignments in vsprocs

Tidy up a lot of places where we initialise a variable, then
immediately assign a proper value to it, or store a return value
that we don't actually care about.

Caught by clang-analyzer

Change-Id: Icf0ec713dac6f2c4f0a60e8ead52a8d3e19381f0
Reviewed-on: http://gerrit.openafs.org/9205
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agogtx: Remove pointless assignments from gtxtest
Simon Wilkinson [Thu, 21 Feb 2013 20:12:35 +0000]
gtx: Remove pointless assignments from gtxtest

Remove assignments to 'code' when we're not going to pay attention
to them.

Caught by clang-analyzer

Change-Id: Ib2f8c20c0bc741d0bb1b8ed4fdb46ea61511fc95
Reviewed-on: http://gerrit.openafs.org/9204
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoUnix CM: Catch ICL initialisation failures
Simon Wilkinson [Thu, 21 Feb 2013 19:34:47 +0000]
Unix CM: Catch ICL initialisation failures

If afs_icl_CreateLog fails, don't still call afS_icl_CreateSet.
If afs_icl_CreateSetWithFlags fails, don't ignore its error code.

Caught by clang-analyzer

Change-Id: I245f4391bbbf183492e8c13fb8f091b339cea80a
Reviewed-on: http://gerrit.openafs.org/9203
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agorx: Fix wrong loop iterator in rx_clearProcessRPCStats
Simon Wilkinson [Tue, 12 Feb 2013 13:04:01 +0000]
rx: Fix wrong loop iterator in rx_clearProcessRPCStats

Fix the use of an incorrect variable as loop iterator which would have
resulted in a crash.

Caught by clang analyzer.

Change-Id: I785d06b9be0915bc540c37b43d1001a562a7cde4
Reviewed-on: http://gerrit.openafs.org/9202
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovolser: Fix a couple of assigned but not read errors
Simon Wilkinson [Wed, 20 Feb 2013 11:18:28 +0000]
volser: Fix a couple of assigned but not read errors

Fix a couple more errors where we assign to a variable, but never
read the result back out.

Caught by clang-analyzer

Change-Id: I78f8f1403d166c4231b0abdb607de77e9ed62a27
Reviewed-on: http://gerrit.openafs.org/9201
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovolser: Don't assign code when we don't care
Simon Wilkinson [Wed, 20 Feb 2013 11:17:41 +0000]
volser: Don't assign code when we don't care

When we're cleaning up temporary volumes, we don't care whether
it succeeds or not. Don't assign code to the results of these
volume deletions, only to then discard it.

Caught by clang-analyzer

Change-Id: I81583cc82e78db38de8aad92c7c7d0c2f44eb33d
Reviewed-on: http://gerrit.openafs.org/9200
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovolser: Don't NULL conn right before assigning it
Simon Wilkinson [Wed, 20 Feb 2013 11:16:25 +0000]
volser: Don't NULL conn right before assigning it

Don't do
   conn = NULL;
   conn = rx_newConnection();

and similar, equally pointless things.

Caught by clang-analyzer

Change-Id: I54d9ccd9f3910624b3289ce067a27622e29e4a34
Reviewed-on: http://gerrit.openafs.org/9199
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agofs: Remove redundant variable assignments
Simon Wilkinson [Tue, 19 Feb 2013 17:25:46 +0000]
fs: Remove redundant variable assignments

Remove a number of redundant variable assignments that clang warns
about.

Caught by clang-analyzer

Change-Id: I248e0e3a9f9241084436604532424d6e4b900e31
Reviewed-on: http://gerrit.openafs.org/9194
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agofs: Free parent_dir later in lsmount and flushmount
Simon Wilkinson [Tue, 19 Feb 2013 17:22:08 +0000]
fs: Free parent_dir later in lsmount and flushmount

If lsmount or flushmount encounter an error, then they may include
the contents of parent_dir in their error message. However, in both
cases, this was freed a couple of lines earlier.

Just move the free() later, so that the contents of this variable
are still available.

Caught by clang-analyzer

Change-Id: Ideba52b7ba98f034baf923194007239a6cf0221f
Reviewed-on: http://gerrit.openafs.org/9193
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoup: Notice errors on both file handles
Simon Wilkinson [Tue, 19 Feb 2013 17:19:53 +0000]
up: Notice errors on both file handles

Report errors on both filehandles in up's Copy routine, rather
than just on the second one that we close.

Caught by clang-analyzer

Change-Id: Ia3aa9be91ccfca2993a4f27c291332e0b0d350f5
Reviewed-on: http://gerrit.openafs.org/9192
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agofstrace: Remove redundant variable assignment
Simon Wilkinson [Tue, 19 Feb 2013 17:18:13 +0000]
fstrace: Remove redundant variable assignment

Don't reset the value of 'code' when nothing else references it.

Caught by clang-analyzer

Change-Id: Ifd361ed6eb8c6b8740466f6c1a337669160874f4
Reviewed-on: http://gerrit.openafs.org/9191
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agofstrace: Avoid accessing icl log after zapping it
Simon Wilkinson [Tue, 19 Feb 2013 17:15:42 +0000]
fstrace: Avoid accessing icl log after zapping it

The for loop in icl_EnumerateLogs looks up the next pointer in the
current entry after zapping it. Depending on reference counts, this
may result in us looking up freed memory.

Take a copy of the next point before zapping the current entry, just
in case.

Caught by clang-analyzer

Change-Id: If38f0af2b01c5b8ea00e68e4432c6ad5517578c8
Reviewed-on: http://gerrit.openafs.org/9190
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoxstat: Ignore return value from xstat_*_Cleanup
Simon Wilkinson [Tue, 19 Feb 2013 16:56:38 +0000]
xstat: Ignore return value from xstat_*_Cleanup

We're about to exit anyway, so we don't care whether Cleanup
succeeds or not

Caught by clang-analyzer

Change-Id: I6350d60e6a5d29b8aaa272a54cf9ead47fdb5fad
Reviewed-on: http://gerrit.openafs.org/9186
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoafsmonitor: Ignore return codes as appropriate
Simon Wilkinson [Tue, 19 Feb 2013 16:45:39 +0000]
afsmonitor: Ignore return codes as appropriate

When we're not interested in the return value of a function, don't
assign it to a variable.

Caught by clang-analyzer

Change-Id: I5b576f312376780c98c2dbe4f9b85e00d529ddd8
Reviewed-on: http://gerrit.openafs.org/9185
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agosys: Flag rmt_Quit as AFS_NORETURN
Simon Wilkinson [Tue, 19 Feb 2013 16:34:14 +0000]
sys: Flag rmt_Quit as AFS_NORETURN

Help out the static analyzer by telling it that rmt_Quit never returns

Change-Id: I5ee0d2ea444706e68af5a1298fd638e7d0d7f41d
Reviewed-on: http://gerrit.openafs.org/9184
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agorxkad: Remove redundant checkCksum initialisation
Simon Wilkinson [Tue, 19 Feb 2013 16:31:28 +0000]
rxkad: Remove redundant checkCksum initialisation

checkCksum is assigned to by both sides of the if() expression, so
there's no need to initialise it to 0.

Caught by clang-analyzer

Change-Id: Id0e286943e11b6948231577085cdb0ce96bb0b97
Reviewed-on: http://gerrit.openafs.org/9183
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoubik: Don't leak memory if mutex init fails
Simon Wilkinson [Tue, 19 Feb 2013 16:15:29 +0000]
ubik: Don't leak memory if mutex init fails

If we can't initialise the ubik_client mutex, don't leak the
structure when returning an error.

Caught by clang-analyzer

Change-Id: Ib36d2ddf585a31b628e56dce1f33ee859fc835bc
Reviewed-on: http://gerrit.openafs.org/9182
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoubik: Don't record result of select()
Simon Wilkinson [Tue, 19 Feb 2013 16:13:34 +0000]
ubik: Don't record result of select()

We never do anything with the return value from select(), so don't
bother storing it into code.

Caught by clang-analyzer

Change-Id: I6e0352b74f0e90b62ad32a3ef1a9d0173bf307ee
Reviewed-on: http://gerrit.openafs.org/9181
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agokauth: Don't ignore GetExtendedCellInfo failures
Simon Wilkinson [Fri, 22 Feb 2013 09:51:24 +0000]
kauth: Don't ignore GetExtendedCellInfo failures

Don't ignore a failure from afsconf_GetExtendedCellInfo, as it will
leave buffers that we later read uninitialised.

Caught by clang-analyzer

Change-Id: Ia0c2675a3083385d011fd340f36bf13373f89feb
Reviewed-on: http://gerrit.openafs.org/9180
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agokauth: Catch ka_KeyCheckSum failures
Simon Wilkinson [Fri, 22 Feb 2013 09:47:57 +0000]
kauth: Catch ka_KeyCheckSum failures

If ka_KeyCheckSum fails, typically because the key being used is bad,
catch the failure rather than just silently ignoring it.

Caught by clang-analyzer

Change-Id: Id51174fdf94356db10961690808670da372bc60e
Reviewed-on: http://gerrit.openafs.org/9179
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agokauth: Fix some unnecessary variable assignments
Simon Wilkinson [Tue, 19 Feb 2013 15:15:42 +0000]
kauth: Fix some unnecessary variable assignments

Remove various places where a variable is assigned to, and then the
result never read.

Caught by clang-analyzer

Change-Id: Id8b7aeb6c54b7c93093ad44df5a9fe01575f2fbe
Reviewed-on: http://gerrit.openafs.org/9172
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoUnix CM: Fix byte accounting for storebehind
Simon Wilkinson [Fri, 22 Feb 2013 16:54:17 +0000]
Unix CM: Fix byte accounting for storebehind

In the current version of CacheStoreDCaches, the stored variable is
maintained within the for loop that iterates over the chunk list. This
means that it is reset to 0 each time we handle a new chunk.

However, this means that our progress is no longer accurately tracked,
as (bytes - stored) no longer gives the number of bytes which remain to
be transfered. In fact, as stored is zeroed with each loop iteration,
(bytes - stored) == bytes. This means that store behind is no longer
activated according to the users settings.

Prior to commit 334114ac58b0039ae90d7e29fa2f019fe068bd79, the
stored variable was maintained within the outer, function, scope.
Just move it back there to restore the previous behaviour.

Caught by clang-analyzer

Change-Id: I248ed81f1331f4d3d4ed2e1206acebb0a8200762
Reviewed-on: http://gerrit.openafs.org/9237
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agoUnix CM: Don't zero args on dcache failure
Simon Wilkinson [Thu, 21 Feb 2013 22:15:11 +0000]
Unix CM: Don't zero args on dcache failure

Even if allocating the dcache fails, there's no point zeroing the
parameters to the allocation function, as those changes aren't
visible outside of that function.

Caught by clang-analyzer

Change-Id: Ieb91b525e818b73e38b8d78a55d170d36273177c
Reviewed-on: http://gerrit.openafs.org/9234
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agoUnix CM: Fix bogus character in license string
Simon Wilkinson [Thu, 21 Feb 2013 22:10:38 +0000]
Unix CM: Fix bogus character in license string

A stray $ had crept into the license string in afs_dcache.c. Fix it.

Change-Id: I1ab096aadb947cb08318a56b9ae21ed0786d3339
Reviewed-on: http://gerrit.openafs.org/9233
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agobos: Don't set up the conenction twice in AddKey
Simon Wilkinson [Thu, 21 Feb 2013 21:29:56 +0000]
bos: Don't set up the conenction twice in AddKey

AddKey calls GetConn twice - once at the start of the function,
and then again immediately before calling BOZO_AddKey. This leaks
a connection...

Caught by clang-analyzer

Change-Id: I5c593de56e7f61fb21b973a34bea1a5b4f4a3177
Reviewed-on: http://gerrit.openafs.org/9230
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agobosserver: Don't check if daemon thread starts
Simon Wilkinson [Thu, 21 Feb 2013 21:24:33 +0000]
bosserver: Don't check if daemon thread starts

We don't do anything with the return code from the LWP_CreateProcess
that starts the daemon thread, so don't bother recording it at all.

Caught by clang-analyzer

Change-Id: I9310bdd90236a90d71dc202c73d7e06ea58a31f8
Reviewed-on: http://gerrit.openafs.org/9229
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agovlserver: Remove dead assignment
Simon Wilkinson [Thu, 21 Feb 2013 21:16:40 +0000]
vlserver: Remove dead assignment

Don't assign the serverNumber to j, when we're just about to try
and get it from a multi homed extent record

Caught by clang-analyzer.

Change-Id: I79349ff211b5df2d16e6ee9122dbb28b04ad7823
Reviewed-on: http://gerrit.openafs.org/9228
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agobosserver: Remove a couple of dead assignments
Simon Wilkinson [Thu, 21 Feb 2013 20:55:35 +0000]
bosserver: Remove a couple of dead assignments

Remove a couple of places where we initialise a variable, only to
assign a new value to it a few lines later.

Caught by clang-analyzer

Change-Id: I096b80cce851f3494475e6f9683715b081ff8375
Reviewed-on: http://gerrit.openafs.org/9208
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agoafsio: Remove redundant assignment
Simon Wilkinson [Tue, 19 Feb 2013 17:12:54 +0000]
afsio: Remove redundant assignment

tbuf is assigned to during the initialisation phase of all of the
for loops that follow, so just remove this assignment

Caught by clang-analyzer

Change-Id: I3f2ffc8cee93768bd03e0abf3b391e1f6c45c70f
Reviewed-on: http://gerrit.openafs.org/9189
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agoWindows: ReleaseNotes reformatting
Jeffrey Altman [Sun, 17 Feb 2013 01:22:27 +0000]
Windows: ReleaseNotes reformatting

Oxygen 14.2 automatically reformatted the text.

Change-Id: I387627948f449c96ed3ab112371752f4673b24d9
Reviewed-on: http://gerrit.openafs.org/9212
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: Direct IO Support for Service
Jeffrey Altman [Sun, 16 Dec 2012 17:42:17 +0000]
Windows: Direct IO Support for Service

This patchset implements and enables by default the new
Direct IO pathway between the AFS redirector and the afsd_service.exe.
When Direct IO is enabled all reads and writes are performed by the
AFS redirector locking memory allocated by the kernel and mapping it into
the service's memory address space.

The service supports cache bypass in this mode when the
AFS_REQUEST_FLAG_CACHE_BYPASS flag is set in the request from the
redirector.  When cache bypass is active, the AFSCache file is ignored and
data is either directly fetched from or stored to the file server.  Cache
bypass is enabled by IIS and other applications that request no
intermediate buffering when opening file handles.   This is often done
because the application implements its own data caching.  All cache bypass
store operations are synchronous.

When cache bypass is not enabled, the memory region provided by the AFS
redirector is either used to populate the cm_buf_t objects or is populated
by them.  When cache bypass is not enabled, one outstanding store
operation can be in flight asynchronously to improve performance.

Direct IO is enabled by default and can be disabled by creating the
registry value.

  ..\Services\TransarcAFSDaemon\Parameters
  "DirectIO"  DWORD  0x0

Change-Id: I3cac3660c8b8eded58226ba4a819692c454704a8
Reviewed-on: http://gerrit.openafs.org/9211
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: Direct IO for AFS Redirector
Peter Scott [Fri, 25 Jan 2013 05:46:37 +0000]
Windows: Direct IO for AFS Redirector

Implement a new IO processing model in which extents are not passed between
afsredirlib.sys and afsd_service.exe.  Instead the AFSCache file is
maintained exclusively by the service and the redirector locks kernel
memory, maps it into the service's address space, and permits the service
to manage all IO directly.

This interface adds an AFS Cache Bypass option to the AFS Redirector which
is activated when the file handle has been opened with the no intermediate
buffering option.

This patchset implements the kernel interface.  A subsequent
patchset will implement the service component.

Assisted by Jeffrey Altman <jaltman@your-file-system.com>

Change-Id: I25a4764db060b3b3f2b0de4006479dd3a220c6eb
Reviewed-on: http://gerrit.openafs.org/9210
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: Add flag BUF_GET_FLAG_BUFCREATE_LOCKED
Jeffrey Altman [Fri, 25 Jan 2013 07:21:27 +0000]
Windows: Add flag BUF_GET_FLAG_BUFCREATE_LOCKED

Modify the buf_Get() and buf_GetNewLocked() interfaces to
permit the cm_scache.bufCreateLocked lock to be held prior to
calling to buf_Get().  Holding the cm_scache.bufCreateLocked lock
before the buf_Get() call prevents a race with another thread
that attempts to set the file size.

Change-Id: I54b13c83801a4d9a2078552d5be7ada6f4607850
Reviewed-on: http://gerrit.openafs.org/9209
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: Set AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED
Jeffrey Altman [Sat, 16 Feb 2013 22:51:12 +0000]
Windows: Set AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED

Set the ObjectInformationCB AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED flag
from within the AFSEnumerateDirectory() function and not from its callers.

Change-Id: I2bddedba1165557679ddd9c637dbeb85cd74e1de
Reviewed-on: http://gerrit.openafs.org/9119
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: Permit direct to service non-wildcard lookups
Peter Scott [Fri, 15 Feb 2013 13:44:06 +0000]
Windows: Permit direct to service non-wildcard lookups

The AFS redirector has required that directories be fully enumerated
when the directory object is opened.  This is a very expensive
operation involving large numbers of file server RPC round trips for
directories with tens of thousands of objects and those containing
symlinks.

This patchset delays directory enumeration for the last component
in a path until such time as dirctory data is requested by the
application.  If the request is for a non-wildcard pattern, the
service will be asked to provide the details for just the one required
object.

Delaying the directory enumeration improves performance for
GetFileAttributes[Ex], GetDiskFreeSpace[Ex], GetVolumeInformation,
and GetNamedSecurityInfo Win32 API calls.   In those cases it is
no longer necessary to enumerate the target directory at all.

Change-Id: I7ef2fbafff925697d8b40e56837ef53bfcc78542
Reviewed-on: http://gerrit.openafs.org/9118
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: EvalByName pass LastComponent flag
Jeffrey Altman [Tue, 19 Feb 2013 04:11:27 +0000]
Windows: EvalByName pass LastComponent flag

Add AFS_REQUEST_FLAG_LAST_COMPONENT flag for use with
AFS_REQUEST_TYPE_EVAL_TARGET_BY_NAME requests to the service.
When set the service will perform cm_Lookup calls without the
CM_FLAG_CHECKPATH flag set.

Change-Id: I47ec2fb8b1e2699f2d87a6625b1db549ecb4e03d
Reviewed-on: http://gerrit.openafs.org/9133
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: EvaluateByName support case-insensitive lookups
Jeffrey Altman [Tue, 19 Feb 2013 02:26:23 +0000]
Windows: EvaluateByName support case-insensitive lookups

Directory lookups in AFS should favor case-sensivite matches
but permit case-insensitive matches otherwise.  The service
should not follow mount points.  The redirector exposes mount
points as junctions.

Change-Id: I34c9244e2756a926f29bbf184dc250e7a29d264f
Reviewed-on: http://gerrit.openafs.org/9132
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: IO Subsystem Trace modifications
Jeffrey Altman [Mon, 18 Feb 2013 15:37:49 +0000]
Windows: IO Subsystem Trace modifications

Display file offsets consistently as %0I64X.

Change-Id: Ib1484ef99fbf055ec4bc00e17469e0daa9661e96
Reviewed-on: http://gerrit.openafs.org/9129
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: Move work item queues over to the Control Device
Rod Widdowson [Tue, 19 Feb 2013 16:12:26 +0000]
Windows: Move work item queues over to the Control Device

Currently, when the library is unloaded it stops all worker
threands and then evaporates the work item queues.  Thus
any work items which are pending will disappear.

Whilst it is OK that the threads going away, any work items need to
remain queued so that when the library is restarted the work
can continue.  This checkin does this by moving the work item
queues and their synchronization primitives into the FS maintained
Control Device Object Extension.  The list of worker threads
remains in the Library Device Object Extension.

Change-Id: If5c7cd3bdfea1a368c8df69649e627bac3a9585f
Reviewed-on: http://gerrit.openafs.org/9139
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: Initialize Irp->IoStatus.Information earlier
Jeffrey Altman [Mon, 18 Feb 2013 15:34:59 +0000]
Windows: Initialize Irp->IoStatus.Information earlier

Initialize Irp->IoStatus.Information to zero immediately upon
beginning processing of the IRP in the write path.

Change-Id: I8d5a717ae8cd3bc44c2a9a65b34fd0549862d293
Reviewed-on: http://gerrit.openafs.org/9128
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: Call CcDeferWrite rather than loop
Rod Widdowson [Mon, 18 Feb 2013 15:33:29 +0000]
Windows: Call CcDeferWrite rather than loop

If we are about to write into the cache and we do not have enough
memory we call CcDeferWrite and return STATUS_PENDING.  This allows
the cache to call us back when there is memory.

The write is performed on the IO queue which is shared wth paging
writes.  However this does not cause paging writes to block in a
memory shortage situation since the request will either be deferred
again (releasing a thread to service a paging write) or will complete
quickly.  Further we allocate all our resources upfront so we fail
fast and in the appropriate place.

Change-Id: I4efbc14a97d3b34236643973f1f8f85c7ea194a6
Reviewed-on: http://gerrit.openafs.org/9127
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: Allow the Library to pend a write request
Rod Widdowson [Fri, 15 Feb 2013 10:57:29 +0000]
Windows: Allow the Library to pend a write request

If the library pends a request pending memory becoming available
then the FS must ensure that the library stays loaded until the
IRP is completed.

Change-Id: Idbfdd84ecd364c99d3ad9cd8dd7e000f47be4b58
Reviewed-on: http://gerrit.openafs.org/9126
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: AFSWriteCommon collapse redundant condition
Rod Widdowson [Fri, 15 Feb 2013 11:48:08 +0000]
Windows: AFSWriteCommon collapse redundant condition

We never get non cached and yet paging IO.  Even if we did it would
be inappropriate to call CcCanIWrite.  Therefore, collapse two if
statements into one.

Change-Id: I95c9030836e4f7dc4f7867a8b8b09b97bf57b429
Reviewed-on: http://gerrit.openafs.org/9125
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoafsio: Ignore return values from afscp_SetDefault*
Simon Wilkinson [Tue, 19 Feb 2013 17:11:50 +0000]
afsio: Ignore return values from afscp_SetDefault*

We don't do anything with the return values from afscp_SetDefaultCell
or afscp_SetDefaultRealm, so just ignore them.

Caught by clang-analyzer

Change-Id: Ib7d9e637e5d08df28ad0085302811b243fb21768
Reviewed-on: http://gerrit.openafs.org/9188
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agoafsio: Don't leak memory on GetVenusFidBy* failure
Simon Wilkinson [Tue, 19 Feb 2013 17:09:15 +0000]
afsio: Don't leak memory on GetVenusFidBy* failure

The GetVenusFid functions all allocate the fid structure immediately
upon entry to the function. When we return with an error, that structure
is never freed.

Update the call sites so that we don't leak this memory.

Caught by clang-analyzer

Change-Id: Iec62316d0fd542e70634f384c8319f90ba6b2649
Reviewed-on: http://gerrit.openafs.org/9187
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agolibafscp: Actually return callback from FindCallback
Simon Wilkinson [Tue, 19 Feb 2013 17:53:11 +0000]
libafscp: Actually return callback from FindCallback

Fix FindCallback so that it actually returns the callback that it
found. This requires changing the function prototype so that the
third parameter is passed by reference, and updating the single
call site.

Caught by clang-analyzer

Change-Id: I420647e9cfd119cf1a26456a91d595b8154ddd85
Reviewed-on: http://gerrit.openafs.org/9198
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agolibafscp: Move server lookup inside AFSCP_DEBUG
Simon Wilkinson [Tue, 19 Feb 2013 17:46:04 +0000]
libafscp: Move server lookup inside AFSCP_DEBUG

We only use the results of the server lookup when AFSCP_DEBUG
is defined, so only bother actually doing the lookup when that
is set.

Caught by clang-analyzer

Change-Id: If79177e9d06817592b0630db7050cf3d40f3ee5f
Reviewed-on: http://gerrit.openafs.org/9197
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agolibafscp: Don't free bogus ptr in ResolvPathFromVol
Simon Wilkinson [Tue, 19 Feb 2013 17:30:14 +0000]
libafscp: Don't free bogus ptr in ResolvPathFromVol

afscp_ResolvPathFromVol makes a copy of the path passed to it using
strdup. It then iterates across that, removing initial '/' characters.
However, this iteration means that 'p' no longer points to the start
of the allocated memory - when we free 'p', we may actually be freeing
an offset into the block, which will make malloc unhappy.

Make a copy of the result from strdup, and use that to free the block.

Caught by clang-analyzer

Change-Id: I0e7d8c7cf3b70baa4868c65fb4c3a32474557628
Reviewed-on: http://gerrit.openafs.org/9196
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agolibafscp: Fix leak when afscp_ResolvPath errors
Simon Wilkinson [Tue, 19 Feb 2013 17:28:12 +0000]
libafscp: Fix leak when afscp_ResolvPath errors

If afscp_DefaultCell fails, then afscp_ResolvPath returns without
freeing the memory allocated to 'p' by strdup.

Fix this by adding a free() in the appropriate place.

Caught by clang-analyzer

Change-Id: Ic2691d209c913cd600d9a9a1ebb4614dff35aa3b
Reviewed-on: http://gerrit.openafs.org/9195
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agoptserver: Don't ignore ubik_Write failures
Simon Wilkinson [Tue, 19 Feb 2013 15:43:29 +0000]
ptserver: Don't ignore ubik_Write failures

If we can't write to the ubik database, then that's a bad thing.
Don't ignore it.

Caught by clang-analyzer

Change-Id: I08b57a74405cc563c6141251fd3d433b2904ea0e
Reviewed-on: http://gerrit.openafs.org/9176
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agoptserver: Tidy malloc handling in readpwd
Simon Wilkinson [Tue, 19 Feb 2013 15:46:52 +0000]
ptserver: Tidy malloc handling in readpwd

Tidy up the malloc handling in readpwd, so that we don't leak memory
if the user specifies multiple -c arguments. Also avoid assuming that
free(NULL) will always work.

Change-Id: I95f3fe908572cb5be2d30345ccae0a2858622bd5
Reviewed-on: http://gerrit.openafs.org/9178
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoptserver: Remove some unnecessary assignments
Simon Wilkinson [Tue, 19 Feb 2013 15:44:21 +0000]
ptserver: Remove some unnecessary assignments

Remove some assignments where we do nothing with the results

Caught by clang-analyzer

Change-Id: I6990a6b21ced10500275176af3f85b7f1cabd334
Reviewed-on: http://gerrit.openafs.org/9177
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agolibacl: Remove unnecessary assignment
Simon Wilkinson [Tue, 19 Feb 2013 15:27:58 +0000]
libacl: Remove unnecessary assignment

Don't assign i to j, when we never use j again in the function

Caught by clang-analyzer

Change-Id: I9dd2d929019ac3cc84cde4e44c4883806bd5964a
Reviewed-on: http://gerrit.openafs.org/9175
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agokauth: Don't store the old signal routine
Simon Wilkinson [Tue, 19 Feb 2013 15:23:25 +0000]
kauth: Don't store the old signal routine

If we're not going to make use of the return from signal() don't
bother assigning it to a variable

Change-Id: I03cae7ab91d49e90f150a9dc4358c173920adc28
Reviewed-on: http://gerrit.openafs.org/9173
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agokauth: Remove unused assignments to bp
Simon Wilkinson [Tue, 19 Feb 2013 15:11:33 +0000]
kauth: Remove unused assignments to bp

We never use the character pointer once we've advanced it past the
slash, so don't bother doing the work of advancing it.

Caught by clang-analyzer

Change-Id: I8ea561d6756685a13892f0635fa2e19b3f1233ab
Reviewed-on: http://gerrit.openafs.org/9171
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agokauth: Remove unused lclpw structure from klog
Simon Wilkinson [Tue, 19 Feb 2013 15:09:41 +0000]
kauth: Remove unused lclpw structure from klog

klog assigns into, but never references, the lclpw structure. Just
remove it.

Caught by clang-analyzer

Change-Id: I8e94f97ee3ee6cb15193ad80dd9aef39e6f8490b
Reviewed-on: http://gerrit.openafs.org/9170
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovolser: Remove needless initialisation
Simon Wilkinson [Tue, 19 Feb 2013 14:59:10 +0000]
volser: Remove needless initialisation

Remove a number of places where we initialise a variable to NULL
immediately before we assign a real value to it.

Caught by clang-analyzer

Change-Id: I74ece8f3a82a5c768d769b74b4ccce12195fc216
Reviewed-on: http://gerrit.openafs.org/9169
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovolser: Remove masked assignment in vol_split
Simon Wilkinson [Tue, 19 Feb 2013 14:51:30 +0000]
volser: Remove masked assignment in vol_split

The declaration (and assignment) to size at the outermost scope
in the copyVnodes function is masked by a later declaration at a
inner scope.

Just remove the outer declaration to clarify what's happening.

Caught by clang-analyzer

Change-Id: If23bdcf8a4c2d23d6224762fecce35be9cf15873
Reviewed-on: http://gerrit.openafs.org/9168
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovos: aserver is private
Simon Wilkinson [Tue, 19 Feb 2013 14:44:14 +0000]
vos: aserver is private

The server specified on the command line is used directly to
initialise the attributes structure. Move the variable so it's
local to the block which uses it, and remove the function-wide
initialiser.

Caught by clang-analyzer

Change-Id: Ia636fae2ed505f6958cefbfbaa72ef7e37edec98
Reviewed-on: http://gerrit.openafs.org/9165
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoauth: Avoid double free in key parsing
Simon Wilkinson [Tue, 12 Feb 2013 12:59:08 +0000]
auth: Avoid double free in key parsing

There was an error path whilst reading an extended key file which could
result in a key being freed using free(key), and then freed again
through the afsconf_typedKey_put() mechanism. Remove this double free.

Caught by clang-analyzer

Change-Id: I40bff56eddf4cb499ae5b7effdaf82f22379109d
Reviewed-on: http://gerrit.openafs.org/9147
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoptserver: Use correct structure type in malloc
Simon Wilkinson [Tue, 12 Feb 2013 13:54:18 +0000]
ptserver: Use correct structure type in malloc

prentries is a list of 'struct prlistentries' objects, not a list of
'struct prentry'. Use the correct type in our call to malloc.

Caught by clang analyzer

Change-Id: I6c36e4b875eafb8aff6506cf800d47b45a79825d
Reviewed-on: http://gerrit.openafs.org/9150
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovol: nuke() doesn't need to zero code
Simon Wilkinson [Tue, 19 Feb 2013 14:48:59 +0000]
vol: nuke() doesn't need to zero code

We don't need to zero the result code two lines before we assign
a new value to it - just remove the pointless assignment

Caught by clang-analyzer

Change-Id: I8fefdc839ef9980d7f7703add3b11b089d524d38
Reviewed-on: http://gerrit.openafs.org/9167
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovol: nuke() doesn't need to maintain next inode ptr
Simon Wilkinson [Tue, 19 Feb 2013 14:47:56 +0000]
vol: nuke() doesn't need to maintain next inode ptr

ni is unused on the true side of the if expression in nuke() - so
just don't bother populating it.

Caught by clang-analyzer

Change-Id: Idfd088f999f4c4bcdabc03b8b86636aa02541343
Reviewed-on: http://gerrit.openafs.org/9166
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agorxgen: Remove pointless assignment
Simon Wilkinson [Fri, 15 Feb 2013 16:35:08 +0000]
rxgen: Remove pointless assignment

The value we assign to defp is never used (it's almost immediately
overwritten), and it is guaranteed to be the same as the existing
value. So, just remove the assignment.

Caught by clang-analyzer

Change-Id: I362fe08c623b5046f2c8b0b16c42dcfa12009981
Reviewed-on: http://gerrit.openafs.org/9162
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agorxgen: Fix memory leak
Simon Wilkinson [Fri, 15 Feb 2013 16:10:18 +0000]
rxgen: Fix memory leak

Don't leak the definition structure when we hit the end of the file

Change-Id: Ief44bb3bdff274167760fda5bcc16903ef8c11ce
Reviewed-on: http://gerrit.openafs.org/9159
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agorxgen: Fix NULL pointer dereference
Simon Wilkinson [Fri, 15 Feb 2013 16:05:33 +0000]
rxgen: Fix NULL pointer dereference

Avoid a NULL pointer dereference if strchr doesn't find any occurence
of '*' in the string. Whilst we handle the not found case when inserting
a mid string terminator, we don't handle it when restoring the string to
its previous value.

Change-Id: Ie0b3e18d89073a1694bba2749111c73f59150bdb
Reviewed-on: http://gerrit.openafs.org/9158
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agorxgen: Silence some uninitialised variable warnings
Simon Wilkinson [Fri, 15 Feb 2013 16:01:26 +0000]
rxgen: Silence some uninitialised variable warnings

Change-Id: Ida939533afbbf2afb81cce44ea6693d33c172062
Reviewed-on: http://gerrit.openafs.org/9157
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoFix incorrect sizeof() arguments in allocations
Simon Wilkinson [Fri, 15 Feb 2013 11:55:37 +0000]
Fix incorrect sizeof() arguments in allocations

In a number of places we have

struct X *val;
val = malloc(sizeof(struct Y));

If sizeof(struct Y) < sizeof(struct X) this is obviously dangerous,
but it is incorrect regardless of the relative sizes of the
structures. Fix all of the occurences of this that clang points out
to us.

Caught by clang-analyzer

Change-Id: Iad32b4ae460d3f40a45cf33624973bf52fd167d4
Reviewed-on: http://gerrit.openafs.org/9156
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoDon't allocate objects of 0 length
Simon Wilkinson [Fri, 15 Feb 2013 11:37:47 +0000]
Don't allocate objects of 0 length

Fix assorted places in the code where we might have asked malloc to
allocate a block of zero length.

Caught by clang-analyzer

Change-Id: I6e1226ad83a52984ee7c53cbed8c867f38e4f866
Reviewed-on: http://gerrit.openafs.org/9155
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoaklog: Don't reference freed node whilst deleting
Simon Wilkinson [Fri, 15 Feb 2013 16:23:16 +0000]
aklog: Don't reference freed node whilst deleting

Because deletion is implemented using a for loop, the step of the
loop that moves us to the next node references freed memory when
we've deleted an element. Fix this by just shortcircuiting the
return from the function so we immediately exit.

Change-Id: Ia820b20ce5937ac86d849cb746b3bc21f46550fa
Reviewed-on: http://gerrit.openafs.org/9161
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

8 years agovos: Remove unused 'done' loop variable
Simon Wilkinson [Tue, 19 Feb 2013 14:41:26 +0000]
vos: Remove unused 'done' loop variable

In SendFile we break at the same time as setting the done flag,
so its value is never checked. Just remove it as it is redundant
with the current loop logic.

Caught by clang-analyzer

Change-Id: Ibf8f756b06fd26cb2013ece97eb9196c71ad88bd
Reviewed-on: http://gerrit.openafs.org/9164
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>