]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
SOLARIS: Avoid uninitialized caller_context_t
authorAndrew Deason <adeason@sinenomine.net>
Fri, 30 Jan 2015 19:08:19 +0000 (13:08 -0600)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 13 Feb 2015 10:02:54 +0000 (05:02 -0500)
Currently we pass a caller_context_t* to some of Solaris' VFS
functions (VOP_SETATTR, VOP_READ, VOP_WRITE, VOP_RWLOCK,
VOP_RWUNLOCK), but the pointer we pass is to uninitialized memory.

This code was added in commit 51d76681, and this particular argument
is mentioned in
<https://lists.openafs.org/pipermail/openafs-info/2004-March/012657.html>,
where the author doesn't really know what the argument is for.

Over 10 years later, it's still not obvious what this argument does,
since I cannot find any documentation for it. However, browsing
publicly-available Illumos/OpenSolaris source suggests this is used
for things like non-blocking operations for network filesystems, and
is only interpreted by certain filesystems in certain codepaths.

In any case, it's clear that we're not supposed to be passing in an
uninitialized structure, since the struct has actual members that are
sometimes interpreted by lower levels. Other callers in
Illumos/OpenSolaris source seem to just pass NULL here if they don't
need any special behavior. So, just pass NULL.

I am not aware of any issues caused by passing in this uninitialized
struct, and browsing Illumos source and discussing the issue with
Oracle engineers suggest there would currently not be any issues with
the cache filesystems we would be using.

However, it's always possible that issues could arise from this in the
future, or there are issues we don't know about. Any such issues would
almost certainly appear to be non-deterministic and be a nightmare to
track down. So just pass NULL, to avoid the potential issues.

Reviewed-on: http://gerrit.openafs.org/11704
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
(cherry picked from commit b9647ac1062509d6a3997ca575ab1542d04677a2)

Change-Id: I5d247cfa6ada3773d20e3938957dcc31c8664bb2
Reviewed-on: http://gerrit.openafs.org/11712
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/SOLARIS/osi_file.c
src/afs/VNOPS/afs_vnop_read.c
src/afs/VNOPS/afs_vnop_write.c

index e0c00579a7a4a4b7eb6577ed08725ce52f31fd19..a0d38a8218ad24645fc4667e0a8383be1bb8a39c 100644 (file)
@@ -327,11 +327,7 @@ osi_UFSTruncate(struct osi_file *afile, afs_int32 asize)
      */
     AFS_GUNLOCK();
 #ifdef AFS_SUN510_ENV
-    {
-       caller_context_t ct;
-
-       code = VOP_SETATTR(afile->vnode, &tvattr, 0, afs_osi_credp, &ct);
-    }
+    code = VOP_SETATTR(afile->vnode, &tvattr, 0, afs_osi_credp, NULL);
 #else
     code = VOP_SETATTR(afile->vnode, &tvattr, 0, afs_osi_credp);
 #endif
index b0f7f0f2e5a58913eb2775b5a7b5a000808ebd23..3bad235a1177f97ba03ba9eee530d32781f6973b 100644 (file)
@@ -862,13 +862,9 @@ afs_UFSRead(struct vcache *avc, struct uio *auio,
 #elif defined(AFS_SUN5_ENV)
            AFS_GUNLOCK();
 #ifdef AFS_SUN510_ENV
-           {
-               caller_context_t ct;
-
-               VOP_RWLOCK(tfile->vnode, 0, &ct);
-               code = VOP_READ(tfile->vnode, &tuio, 0, afs_osi_credp, &ct);
-               VOP_RWUNLOCK(tfile->vnode, 0, &ct);
-           }
+           VOP_RWLOCK(tfile->vnode, 0, NULL);
+           code = VOP_READ(tfile->vnode, &tuio, 0, afs_osi_credp, NULL);
+           VOP_RWUNLOCK(tfile->vnode, 0, NULL);
 #else
            VOP_RWLOCK(tfile->vnode, 0);
            code = VOP_READ(tfile->vnode, &tuio, 0, afs_osi_credp);
index 07b38ff45a9fc1186e16316805007439d8fa23fb..068dbac5dff7da1b65dc9faccd6bb31af9f6eb6e 100644 (file)
@@ -470,13 +470,9 @@ afs_UFSWrite(struct vcache *avc, struct uio *auio, int aio,
 #elif defined(AFS_SUN5_ENV)
        AFS_GUNLOCK();
 #ifdef AFS_SUN510_ENV
-       {
-           caller_context_t ct;
-
-           VOP_RWLOCK(tfile->vnode, 1, &ct);
-           code = VOP_WRITE(tfile->vnode, &tuio, 0, afs_osi_credp, &ct);
-           VOP_RWUNLOCK(tfile->vnode, 1, &ct);
-       }
+       VOP_RWLOCK(tfile->vnode, 1, NULL);
+       code = VOP_WRITE(tfile->vnode, &tuio, 0, afs_osi_credp, NULL);
+       VOP_RWUNLOCK(tfile->vnode, 1, NULL);
 #else
        VOP_RWLOCK(tfile->vnode, 1);
        code = VOP_WRITE(tfile->vnode, &tuio, 0, afs_osi_credp);