Skip to content

Commit 3be542d

Browse files
committed
Merge tag 'nfs-for-3.11-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client bugfixes from Trond Myklebust: - Fix a regression against NFSv4 FreeBSD servers when creating a new file - Fix another regression in rpc_client_register() * tag 'nfs-for-3.11-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: NFSv4: Fix a regression against the FreeBSD server SUNRPC: Fix another issue with rpc_client_register()
2 parents 90290c4 + b4a2cf7 commit 3be542d

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

fs/nfs/nfs4xdr.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,
999999
__be32 *p;
10001000
__be32 *q;
10011001
int len;
1002+
uint32_t bmval_len = 2;
10021003
uint32_t bmval0 = 0;
10031004
uint32_t bmval1 = 0;
10041005
uint32_t bmval2 = 0;
@@ -1010,7 +1011,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,
10101011
* = 40 bytes, plus any contribution from variable-length fields
10111012
* such as owner/group.
10121013
*/
1013-
len = 20;
1014+
len = 8;
10141015

10151016
/* Sigh */
10161017
if (iap->ia_valid & ATTR_SIZE)
@@ -1040,8 +1041,6 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,
10401041
}
10411042
len += 4 + (XDR_QUADLEN(owner_grouplen) << 2);
10421043
}
1043-
if (label)
1044-
len += 4 + 4 + 4 + (XDR_QUADLEN(label->len) << 2);
10451044
if (iap->ia_valid & ATTR_ATIME_SET)
10461045
len += 16;
10471046
else if (iap->ia_valid & ATTR_ATIME)
@@ -1050,15 +1049,22 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,
10501049
len += 16;
10511050
else if (iap->ia_valid & ATTR_MTIME)
10521051
len += 4;
1052+
if (label) {
1053+
len += 4 + 4 + 4 + (XDR_QUADLEN(label->len) << 2);
1054+
bmval_len = 3;
1055+
}
1056+
1057+
len += bmval_len << 2;
10531058
p = reserve_space(xdr, len);
10541059

10551060
/*
10561061
* We write the bitmap length now, but leave the bitmap and the attribute
10571062
* buffer length to be backfilled at the end of this routine.
10581063
*/
1059-
*p++ = cpu_to_be32(3);
1064+
*p++ = cpu_to_be32(bmval_len);
10601065
q = p;
1061-
p += 4;
1066+
/* Skip bitmap entries + attrlen */
1067+
p += bmval_len + 1;
10621068

10631069
if (iap->ia_valid & ATTR_SIZE) {
10641070
bmval0 |= FATTR4_WORD0_SIZE;
@@ -1112,10 +1118,11 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,
11121118
len, ((char *)p - (char *)q) + 4);
11131119
BUG();
11141120
}
1115-
len = (char *)p - (char *)q - 16;
1121+
len = (char *)p - (char *)q - (bmval_len << 2);
11161122
*q++ = htonl(bmval0);
11171123
*q++ = htonl(bmval1);
1118-
*q++ = htonl(bmval2);
1124+
if (bmval_len == 3)
1125+
*q++ = htonl(bmval2);
11191126
*q = htonl(len);
11201127

11211128
/* out: */

net/sunrpc/clnt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ static int rpc_client_register(const struct rpc_create_args *args,
309309
return 0;
310310
err_auth:
311311
pipefs_sb = rpc_get_sb_net(net);
312+
rpc_unregister_client(clnt);
312313
__rpc_clnt_remove_pipedir(clnt);
313314
out:
314315
if (pipefs_sb)

0 commit comments

Comments
 (0)