Linux: Fix return codes from setpag
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 15 Mar 2011 00:45:45 +0000 (00:45 +0000)
committerDerrick Brashear <shadow@dementia.org>
Tue, 15 Mar 2011 02:28:15 +0000 (19:28 -0700)
commit3d92852ba99bc7591515992dfea3436d93c23b85
tree889b7922c12ffb86a49045b94a6aef4cf69260d1
parentff2933a122ddf9421ebcacdc7e4ec5f44333f894
Linux: Fix return codes from setpag

Linux is a real stickler when it comes to error codes. Functions
which return positive error codes into the kernel tend to have
unfortunate effects. Because all AFS errors tend to be positive,
most of our kernel entry points negate errors before passing them
back to their caller.

This causes problems when internal functions themselves return
negative error codes. This was the case with the keyring functions,
which ended up returning a negative code to setpag(), this handed
that code ultimately up to the ioctl handler, which negated it (so
turning it positive) before throwing it up to the kernel.

The kernel sees this positive value as being a successful return,
and so passes it direct to userland, rather than assigning it to
errno. This led to the setpag() userspace function never being
aware of keyring errors that had occurred in the kernel.

Fix all this by making sure that all errors from the keyring code
are made positive before being passed upwards in the kernel module.

Change-Id: I31eeaf9a4819dc47052ea0ff3070bdaaf22f1f66
Reviewed-on: http://gerrit.openafs.org/4223
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/afs/LINUX/osi_groups.c