|
@@ -1001,7 +1001,8 @@ static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *ve
|
|
|
|
|
|
static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,
|
|
|
const struct nfs4_label *label,
|
|
|
- const struct nfs_server *server)
|
|
|
+ const struct nfs_server *server,
|
|
|
+ bool excl_check)
|
|
|
{
|
|
|
char owner_name[IDMAP_NAMESZ];
|
|
|
char owner_group[IDMAP_NAMESZ];
|
|
@@ -1067,6 +1068,17 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,
|
|
|
bmval[1] |= FATTR4_WORD1_TIME_MODIFY_SET;
|
|
|
len += 4;
|
|
|
}
|
|
|
+
|
|
|
+ if (excl_check) {
|
|
|
+ const u32 *excl_bmval = server->exclcreat_bitmask;
|
|
|
+ bmval[0] &= excl_bmval[0];
|
|
|
+ bmval[1] &= excl_bmval[1];
|
|
|
+ bmval[2] &= excl_bmval[2];
|
|
|
+
|
|
|
+ if (!(excl_bmval[2] & FATTR4_WORD2_SECURITY_LABEL))
|
|
|
+ label = NULL;
|
|
|
+ }
|
|
|
+
|
|
|
if (label) {
|
|
|
len += 4 + 4 + 4 + (XDR_QUADLEN(label->len) << 2);
|
|
|
bmval[2] |= FATTR4_WORD2_SECURITY_LABEL;
|
|
@@ -1170,7 +1182,7 @@ static void encode_create(struct xdr_stream *xdr, const struct nfs4_create_arg *
|
|
|
}
|
|
|
|
|
|
encode_string(xdr, create->name->len, create->name->name);
|
|
|
- encode_attrs(xdr, create->attrs, create->label, create->server);
|
|
|
+ encode_attrs(xdr, create->attrs, create->label, create->server, false);
|
|
|
}
|
|
|
|
|
|
static void encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap, struct compound_hdr *hdr)
|
|
@@ -1384,18 +1396,17 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena
|
|
|
|
|
|
static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg)
|
|
|
{
|
|
|
- struct iattr dummy;
|
|
|
__be32 *p;
|
|
|
|
|
|
p = reserve_space(xdr, 4);
|
|
|
switch(arg->createmode) {
|
|
|
case NFS4_CREATE_UNCHECKED:
|
|
|
*p = cpu_to_be32(NFS4_CREATE_UNCHECKED);
|
|
|
- encode_attrs(xdr, arg->u.attrs, arg->label, arg->server);
|
|
|
+ encode_attrs(xdr, arg->u.attrs, arg->label, arg->server, false);
|
|
|
break;
|
|
|
case NFS4_CREATE_GUARDED:
|
|
|
*p = cpu_to_be32(NFS4_CREATE_GUARDED);
|
|
|
- encode_attrs(xdr, arg->u.attrs, arg->label, arg->server);
|
|
|
+ encode_attrs(xdr, arg->u.attrs, arg->label, arg->server, false);
|
|
|
break;
|
|
|
case NFS4_CREATE_EXCLUSIVE:
|
|
|
*p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE);
|
|
@@ -1404,8 +1415,7 @@ static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_op
|
|
|
case NFS4_CREATE_EXCLUSIVE4_1:
|
|
|
*p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE4_1);
|
|
|
encode_nfs4_verifier(xdr, &arg->u.verifier);
|
|
|
- dummy.ia_valid = 0;
|
|
|
- encode_attrs(xdr, &dummy, arg->label, arg->server);
|
|
|
+ encode_attrs(xdr, arg->u.attrs, arg->label, arg->server, true);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1661,7 +1671,7 @@ static void encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs
|
|
|
{
|
|
|
encode_op_hdr(xdr, OP_SETATTR, decode_setattr_maxsz, hdr);
|
|
|
encode_nfs4_stateid(xdr, &arg->stateid);
|
|
|
- encode_attrs(xdr, arg->iap, arg->label, server);
|
|
|
+ encode_attrs(xdr, arg->iap, arg->label, server, false);
|
|
|
}
|
|
|
|
|
|
static void encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclientid *setclientid, struct compound_hdr *hdr)
|