Re: [PATCH v2] nfsidmap: keyctl_invalidate kernel compatibility

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxx>
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;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux