Linux NFS development
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Benjamin Coddington <bcodding@redhat.com>, linux-nfs@vger.kernel.org
Cc: chuck.lever@oracle.com
Subject: Re: [PATCH v2] nfsidmap: keyctl_invalidate kernel compatibility
Date: Tue, 04 Nov 2014 14:37:50 -0500	[thread overview]
Message-ID: <54592B0E.5050201@RedHat.com> (raw)
In-Reply-To: <eee96450255a3407517dd1ed4ce9991ba9f2dbd1.1415034378.git.bcodding@redhat.com>



On 11/03/2014 12:12 PM, Benjamin Coddington wrote:
> Change the keyctl_invalidate call to use the syscall interface directly so
> that when building with libkeyutils missing keyctl_invalidate the build succeeds.
> Attempt to use _invalidate and fall back to _revoke if the current kernel is
> missing _invalidate.
> 
> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Committed... 

This does get by the nfsidmap compile error when 
compiling on RHEL6, but not the ones in nfsdcltrack/sqlite.c
(http://ur1.ca/ioyfs)

Chuck, how are you getting around them?

steved.

> ---
>  utils/nfsidmap/nfsidmap.c |   21 +++++++++++++++++----
>  1 files changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/utils/nfsidmap/nfsidmap.c b/utils/nfsidmap/nfsidmap.c
> index e0d31e7..96149cc 100644
> --- a/utils/nfsidmap/nfsidmap.c
> +++ b/utils/nfsidmap/nfsidmap.c
> @@ -209,10 +209,23 @@ static int key_invalidate(char *keystr, int keymask)
>  		*(strchr(buf, ' ')) = '\0';
>  		sscanf(buf, "%x", &key);
>  
> -		if (keyctl_invalidate(key) < 0) {
> -			xlog_err("keyctl_invalidate(0x%x) failed: %m", key);
> -			fclose(fp);
> -			return 1;
> +/* older libkeyutils compatibility */
> +#ifndef KEYCTL_INVALIDATE
> +#define KEYCTL_INVALIDATE 21      /* invalidate a key */
> +#endif
> +		if (keyctl(KEYCTL_INVALIDATE, key) < 0) {
> +			if (errno != EOPNOTSUPP) {
> +				xlog_err("keyctl_invalidate(0x%x) failed: %m", key);
> +				fclose(fp);
> +				return 1;
> +			} else {
> +				/* older kernel compatibility attempt: */
> +				if (keyctl_revoke(key) < 0) {
> +					xlog_err("keyctl_revoke(0x%x) failed: %m", key);
> +					fclose(fp);
> +					return 1;
> +				}
> +			}
>  		}
>  
>  		keymask &= ~mask;
> 

  reply	other threads:[~2014-11-04 19:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-03 17:12 [PATCH v2] nfsidmap: keyctl_invalidate kernel compatibility Benjamin Coddington
2014-11-04 19:37 ` Steve Dickson [this message]
2014-11-04 20:44   ` Chuck Lever
2014-11-17 16:54     ` Chuck Lever
2014-11-17 17:11       ` Jeff Layton
2014-11-17 17:28         ` Chuck Lever
2014-11-17 17:48           ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54592B0E.5050201@RedHat.com \
    --to=steved@redhat.com \
    --cc=bcodding@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox