NFSv4.2: query the server for extended attribute support
Query the server for extended attribute support, and record it as the NFS_CAP_XATTR flag in the server capabilities. Signed-off-by: Frank van der Linden <fllinden@amazon.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:

committed by
Trond Myklebust

parent
04a5da690e
commit
b78ef845c3
@@ -4201,6 +4201,26 @@ static int decode_attr_time_modify(struct xdr_stream *xdr, uint32_t *bitmap, str
|
||||
return status;
|
||||
}
|
||||
|
||||
static int decode_attr_xattrsupport(struct xdr_stream *xdr, uint32_t *bitmap,
|
||||
uint32_t *res)
|
||||
{
|
||||
__be32 *p;
|
||||
|
||||
*res = 0;
|
||||
if (unlikely(bitmap[2] & (FATTR4_WORD2_XATTR_SUPPORT - 1U)))
|
||||
return -EIO;
|
||||
if (likely(bitmap[2] & FATTR4_WORD2_XATTR_SUPPORT)) {
|
||||
p = xdr_inline_decode(xdr, 4);
|
||||
if (unlikely(!p))
|
||||
return -EIO;
|
||||
*res = be32_to_cpup(p);
|
||||
bitmap[2] &= ~FATTR4_WORD2_XATTR_SUPPORT;
|
||||
}
|
||||
dprintk("%s: XATTR support=%s\n", __func__,
|
||||
*res == 0 ? "false" : "true");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int verify_attr_len(struct xdr_stream *xdr, unsigned int savep, uint32_t attrlen)
|
||||
{
|
||||
unsigned int attrwords = XDR_QUADLEN(attrlen);
|
||||
@@ -4855,6 +4875,11 @@ static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo)
|
||||
if (status)
|
||||
goto xdr_error;
|
||||
|
||||
status = decode_attr_xattrsupport(xdr, bitmap,
|
||||
&fsinfo->xattr_support);
|
||||
if (status)
|
||||
goto xdr_error;
|
||||
|
||||
status = verify_attr_len(xdr, savep, attrlen);
|
||||
xdr_error:
|
||||
dprintk("%s: xdr returned %d!\n", __func__, -status);
|
||||
|
Reference in New Issue
Block a user