Skip to content

Commit 6fdf339

Browse files
committed
NFSv4.2: Fix warning "variable ‘stateids’ set but not used"
Replace it with a test for whether or not the sent a stateid in violation of what we asked for. Signed-off-by: Trond Myklebust <[email protected]>
1 parent 1399782 commit 6fdf339

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

fs/nfs/nfs42xdr.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,21 @@ static int decode_write_response(struct xdr_stream *xdr,
330330
struct nfs42_write_res *res)
331331
{
332332
__be32 *p;
333-
int stateids;
334333

335334
p = xdr_inline_decode(xdr, 4 + 8 + 4);
336335
if (unlikely(!p))
337336
goto out_overflow;
338337

339-
stateids = be32_to_cpup(p++);
338+
/*
339+
* We never use asynchronous mode, so warn if a server returns
340+
* a stateid.
341+
*/
342+
if (unlikely(*p != 0)) {
343+
pr_err_once("%s: server has set unrequested "
344+
"asynchronous mode\n", __func__);
345+
return -EREMOTEIO;
346+
}
347+
p++;
340348
p = xdr_decode_hyper(p, &res->count);
341349
res->verifier.committed = be32_to_cpup(p);
342350
return decode_verifier(xdr, &res->verifier.verifier);

0 commit comments

Comments
 (0)