Commit 6eaebcd9 authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

nfs4: add initial support `support_xattr` attribute

Motivation:
As client might chack for support of extended attribute, let server
nicely reply 'not supported'

Modification:
introduce FATTR4_XATTR_SUPPORT bit in bitmask of support attributes.
Reply hard-coded 'not supported' as long as backend file system can't be
queried for this information.

Result:
client can auto-discover (not yet) that whatever extended attributes are
supported or not.

Acked-by: Lea Morschel
Acked-by: Paul Millar
Target: master
parent 1c80fb61
/*
* Copyright (c) 2009 - 2017 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2019 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
......@@ -92,6 +92,7 @@ public interface NFSv4FileAttributes {
// word3
static final int FATTR4_SUPPATTR_EXCLCREAT = (1 << 11) ;
static final int FATTR4_XATTR_SUPPORT = (1 << 18) ;
/**
......@@ -158,7 +159,8 @@ public interface NFSv4FileAttributes {
FATTR4_FS_LAYOUT_TYPE ; // want to be a 4.1 server
public final static int NFS4_SUPPORTED_ATTRS_MASK3 =
FATTR4_SUPPATTR_EXCLCREAT;
FATTR4_SUPPATTR_EXCLCREAT |
FATTR4_XATTR_SUPPORT;
// all writable attributes of word0 and word1
public final static int[] EXCLCREAT_ATTR = new int[] {
......
......@@ -37,6 +37,7 @@ import org.dcache.nfs.v4.xdr.fattr4_owner;
import org.dcache.nfs.v4.xdr.fattr4_space_used;
import org.dcache.nfs.v4.xdr.fattr4_maxlink;
import org.dcache.nfs.v4.xdr.fattr4_unique_handles;
import org.dcache.nfs.v4.xdr.fattr4_xattr_support;
import org.dcache.nfs.v4.xdr.fattr4_lease_time;
import org.dcache.nfs.v4.xdr.uint64_t;
import org.dcache.nfs.v4.xdr.fattr4_fh_expire_type;
......@@ -405,6 +406,8 @@ public class OperationGETATTR extends AbstractNFSv4Operation {
return Optional.of(fs_layout_type);
case nfs4_prot.FATTR4_SUPPATTR_EXCLCREAT:
return Optional.of(new fattr4_supported_attrs(NFSv4FileAttributes.EXCLCREAT_ATTR));
case nfs4_prot.FATTR4_XATTR_SUPPORT:
return Optional.of(new fattr4_xattr_support(false));
case nfs4_prot.FATTR4_TIME_MODIFY_SET:
case nfs4_prot.FATTR4_TIME_ACCESS_SET:
throw new InvalException("getattr of write-only attributes");
......
/*
* Automatically generated by jrpcgen 1.0.7+ on 11/1/19, 1:52 PM
* jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
* See http://remotetea.sourceforge.net for details
*
* This version of jrpcgen adopted by dCache project
* See http://www.dCache.ORG for details
*/
package org.dcache.nfs.v4.xdr;
import org.dcache.oncrpc4j.rpc.*;
import org.dcache.oncrpc4j.xdr.*;
import java.io.IOException;
public class fattr4_xattr_support implements XdrAble {
public boolean value;
public fattr4_xattr_support() {
}
public fattr4_xattr_support(boolean value) {
this.value = value;
}
public fattr4_xattr_support(XdrDecodingStream xdr)
throws OncRpcException, IOException {
xdrDecode(xdr);
}
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
xdr.xdrEncodeBoolean(value);
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
value = xdr.xdrDecodeBoolean();
}
}
// End of fattr4_xattr_support.java
......@@ -275,6 +275,6 @@ public interface nfs4_prot {
public static final int ACCESS4_XAREAD = 0x00000040;
public static final int ACCESS4_XALIST = 0x00000100;
public static final int ACCESS4_XAWRITE = 0x00000080;
public static final int FATTR4_XATTR_SUPPORT = 82;
}
// End of nfs4_prot.java
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment