Skip to content

Commit 67aa744

Browse files
olgakorn1amschuma-ntap
authored andcommitted
NFS COPY xdr handle async reply
If server returns async reply, it must include a callback stateid, wr_callback_id in the write_response4. Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent cb95dee commit 67aa744

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

fs/nfs/nfs42xdr.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -389,21 +389,23 @@ static int decode_write_response(struct xdr_stream *xdr,
389389
struct nfs42_write_res *res)
390390
{
391391
__be32 *p;
392+
int status, count;
392393

393-
p = xdr_inline_decode(xdr, 4 + 8 + 4);
394+
p = xdr_inline_decode(xdr, 4);
394395
if (unlikely(!p))
395396
goto out_overflow;
396-
397-
/*
398-
* We never use asynchronous mode, so warn if a server returns
399-
* a stateid.
400-
*/
401-
if (unlikely(*p != 0)) {
402-
pr_err_once("%s: server has set unrequested "
403-
"asynchronous mode\n", __func__);
397+
count = be32_to_cpup(p);
398+
if (count > 1)
404399
return -EREMOTEIO;
400+
else if (count == 1) {
401+
status = decode_opaque_fixed(xdr, &res->stateid,
402+
NFS4_STATEID_SIZE);
403+
if (unlikely(status))
404+
goto out_overflow;
405405
}
406-
p++;
406+
p = xdr_inline_decode(xdr, 8 + 4);
407+
if (unlikely(!p))
408+
goto out_overflow;
407409
p = xdr_decode_hyper(p, &res->count);
408410
res->verifier.committed = be32_to_cpup(p);
409411
return decode_verifier(xdr, &res->verifier.verifier);

include/linux/nfs_xdr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,7 @@ struct nfs42_copy_args {
13911391
};
13921392

13931393
struct nfs42_write_res {
1394+
nfs4_stateid stateid;
13941395
u64 count;
13951396
struct nfs_writeverf verifier;
13961397
};

0 commit comments

Comments
 (0)