diff options
author | J. Bruce Fields <bfields@redhat.com> | 2014-03-06 20:39:29 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-05-27 11:09:08 -0400 |
commit | 07d1f8020738ba3180ea9992c4fa7dbc0685396a (patch) | |
tree | 3c400bbbe4c453f6b1d5afddf3d7bfae77e81daa /fs/nfsd/nfs4proc.c | |
parent | 1802a67894fab3ff90a3ef4f484e97a5b4515426 (diff) |
nfsd4: fix encoding of out-of-space replies
If nfsd4_check_resp_size() returns an error then we should really be
truncating the reply here, otherwise we may leave extra garbage at the
end of the rpc reply.
Also add a warning to catch any cases where our reply-size estimates may
be wrong in the case of a non-idempotent operation.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4proc.c')
-rw-r--r-- | fs/nfsd/nfs4proc.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 747d6a87a47d..bf8cddfdd3be 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -1171,9 +1171,7 @@ struct nfsd4_operation { | |||
1171 | 1171 | ||
1172 | static struct nfsd4_operation nfsd4_ops[]; | 1172 | static struct nfsd4_operation nfsd4_ops[]; |
1173 | 1173 | ||
1174 | #ifdef NFSD_DEBUG | ||
1175 | static const char *nfsd4_op_name(unsigned opnum); | 1174 | static const char *nfsd4_op_name(unsigned opnum); |
1176 | #endif | ||
1177 | 1175 | ||
1178 | /* | 1176 | /* |
1179 | * Enforce NFSv4.1 COMPOUND ordering rules: | 1177 | * Enforce NFSv4.1 COMPOUND ordering rules: |
@@ -1859,14 +1857,21 @@ static struct nfsd4_operation nfsd4_ops[] = { | |||
1859 | }, | 1857 | }, |
1860 | }; | 1858 | }; |
1861 | 1859 | ||
1862 | #ifdef NFSD_DEBUG | 1860 | void warn_on_nonidempotent_op(struct nfsd4_op *op) |
1861 | { | ||
1862 | if (OPDESC(op)->op_flags & OP_MODIFIES_SOMETHING) { | ||
1863 | pr_err("unable to encode reply to nonidempotent op %d (%s)\n", | ||
1864 | op->opnum, nfsd4_op_name(op->opnum)); | ||
1865 | WARN_ON_ONCE(1); | ||
1866 | } | ||
1867 | } | ||
1868 | |||
1863 | static const char *nfsd4_op_name(unsigned opnum) | 1869 | static const char *nfsd4_op_name(unsigned opnum) |
1864 | { | 1870 | { |
1865 | if (opnum < ARRAY_SIZE(nfsd4_ops)) | 1871 | if (opnum < ARRAY_SIZE(nfsd4_ops)) |
1866 | return nfsd4_ops[opnum].op_name; | 1872 | return nfsd4_ops[opnum].op_name; |
1867 | return "unknown_operation"; | 1873 | return "unknown_operation"; |
1868 | } | 1874 | } |
1869 | #endif | ||
1870 | 1875 | ||
1871 | #define nfsd4_voidres nfsd4_voidargs | 1876 | #define nfsd4_voidres nfsd4_voidargs |
1872 | struct nfsd4_voidargs { int dummy; }; | 1877 | struct nfsd4_voidargs { int dummy; }; |