aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2011-09-20 08:49:51 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-09-20 14:45:51 -0400
commitc856694e3d46976c76bf5b92091cb1efa211208d (patch)
treeddb46a25f9595302c76de0e857c128c9d859bccd
parent3d02fa29dec920c597dd7b7db608a4bc71f088ce (diff)
nfsd4: make op_cacheresult another flag
I'm not sure why I used a new field for this originally. Also, the differences between some of these flags are a little subtle; add some comments to explain. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfs4proc.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index aa769dfa756a..4e41f65c7021 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1013,14 +1013,15 @@ enum nfsd4_op_flags {
1013 /* For rfc 5661 section 2.6.3.1.1: */ 1013 /* For rfc 5661 section 2.6.3.1.1: */
1014 OP_HANDLES_WRONGSEC = 1 << 3, 1014 OP_HANDLES_WRONGSEC = 1 << 3,
1015 OP_IS_PUTFH_LIKE = 1 << 4, 1015 OP_IS_PUTFH_LIKE = 1 << 4,
1016 OP_MODIFIES_SOMETHING = 1 << 5, /* op is non-idempotent */
1017};
1018
1019struct nfsd4_operation {
1020 nfsd4op_func op_func;
1021 u32 op_flags;
1022 char *op_name;
1023 /* 1016 /*
1017 * These are the ops whose result size we estimate before
1018 * encoding, to avoid performing an op then not being able to
1019 * respond or cache a response. This includes writes and setattrs
1020 * as well as the operations usually called "nonidempotent":
1021 */
1022 OP_MODIFIES_SOMETHING = 1 << 5,
1023 /*
1024 * Cache compounds containing these ops in the xid-based drc:
1024 * We use the DRC for compounds containing non-idempotent 1025 * We use the DRC for compounds containing non-idempotent
1025 * operations, *except* those that are 4.1-specific (since 1026 * operations, *except* those that are 4.1-specific (since
1026 * sessions provide their own EOS), and except for stateful 1027 * sessions provide their own EOS), and except for stateful
@@ -1028,7 +1029,13 @@ struct nfsd4_operation {
1028 * (since sequence numbers provide EOS for open, lock, etc in 1029 * (since sequence numbers provide EOS for open, lock, etc in
1029 * the v4.0 case). 1030 * the v4.0 case).
1030 */ 1031 */
1031 bool op_cacheresult; 1032 OP_CACHEME = 1 << 6,
1033};
1034
1035struct nfsd4_operation {
1036 nfsd4op_func op_func;
1037 u32 op_flags;
1038 char *op_name;
1032 /* Try to get response size before operation */ 1039 /* Try to get response size before operation */
1033 nfsd4op_rsize op_rsize_bop; 1040 nfsd4op_rsize op_rsize_bop;
1034}; 1041};
@@ -1077,7 +1084,7 @@ static inline struct nfsd4_operation *OPDESC(struct nfsd4_op *op)
1077 1084
1078bool nfsd4_cache_this_op(struct nfsd4_op *op) 1085bool nfsd4_cache_this_op(struct nfsd4_op *op)
1079{ 1086{
1080 return OPDESC(op)->op_cacheresult; 1087 return OPDESC(op)->op_flags & OP_CACHEME;
1081} 1088}
1082 1089
1083static bool need_wrongsec_check(struct svc_rqst *rqstp) 1090static bool need_wrongsec_check(struct svc_rqst *rqstp)
@@ -1420,9 +1427,8 @@ static struct nfsd4_operation nfsd4_ops[] = {
1420 }, 1427 },
1421 [OP_CREATE] = { 1428 [OP_CREATE] = {
1422 .op_func = (nfsd4op_func)nfsd4_create, 1429 .op_func = (nfsd4op_func)nfsd4_create,
1423 .op_flags = OP_MODIFIES_SOMETHING, 1430 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
1424 .op_name = "OP_CREATE", 1431 .op_name = "OP_CREATE",
1425 .op_cacheresult = true,
1426 .op_rsize_bop = (nfsd4op_rsize)nfsd4_create_rsize, 1432 .op_rsize_bop = (nfsd4op_rsize)nfsd4_create_rsize,
1427 }, 1433 },
1428 [OP_DELEGRETURN] = { 1434 [OP_DELEGRETURN] = {
@@ -1442,9 +1448,9 @@ static struct nfsd4_operation nfsd4_ops[] = {
1442 }, 1448 },
1443 [OP_LINK] = { 1449 [OP_LINK] = {
1444 .op_func = (nfsd4op_func)nfsd4_link, 1450 .op_func = (nfsd4op_func)nfsd4_link,
1445 .op_flags = ALLOWED_ON_ABSENT_FS | OP_MODIFIES_SOMETHING, 1451 .op_flags = ALLOWED_ON_ABSENT_FS | OP_MODIFIES_SOMETHING
1452 | OP_CACHEME,
1446 .op_name = "OP_LINK", 1453 .op_name = "OP_LINK",
1447 .op_cacheresult = true,
1448 .op_rsize_bop = (nfsd4op_rsize)nfsd4_link_rsize, 1454 .op_rsize_bop = (nfsd4op_rsize)nfsd4_link_rsize,
1449 }, 1455 },
1450 [OP_LOCK] = { 1456 [OP_LOCK] = {
@@ -1534,16 +1540,14 @@ static struct nfsd4_operation nfsd4_ops[] = {
1534 }, 1540 },
1535 [OP_REMOVE] = { 1541 [OP_REMOVE] = {
1536 .op_func = (nfsd4op_func)nfsd4_remove, 1542 .op_func = (nfsd4op_func)nfsd4_remove,
1537 .op_flags = OP_MODIFIES_SOMETHING, 1543 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
1538 .op_name = "OP_REMOVE", 1544 .op_name = "OP_REMOVE",
1539 .op_cacheresult = true,
1540 .op_rsize_bop = (nfsd4op_rsize)nfsd4_remove_rsize, 1545 .op_rsize_bop = (nfsd4op_rsize)nfsd4_remove_rsize,
1541 }, 1546 },
1542 [OP_RENAME] = { 1547 [OP_RENAME] = {
1543 .op_func = (nfsd4op_func)nfsd4_rename, 1548 .op_func = (nfsd4op_func)nfsd4_rename,
1544 .op_flags = OP_MODIFIES_SOMETHING, 1549 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
1545 .op_name = "OP_RENAME", 1550 .op_name = "OP_RENAME",
1546 .op_cacheresult = true,
1547 .op_rsize_bop = (nfsd4op_rsize)nfsd4_rename_rsize, 1551 .op_rsize_bop = (nfsd4op_rsize)nfsd4_rename_rsize,
1548 }, 1552 },
1549 [OP_RENEW] = { 1553 [OP_RENEW] = {
@@ -1575,24 +1579,21 @@ static struct nfsd4_operation nfsd4_ops[] = {
1575 [OP_SETATTR] = { 1579 [OP_SETATTR] = {
1576 .op_func = (nfsd4op_func)nfsd4_setattr, 1580 .op_func = (nfsd4op_func)nfsd4_setattr,
1577 .op_name = "OP_SETATTR", 1581 .op_name = "OP_SETATTR",
1578 .op_flags = OP_MODIFIES_SOMETHING, 1582 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
1579 .op_cacheresult = true,
1580 .op_rsize_bop = (nfsd4op_rsize)nfsd4_setattr_rsize, 1583 .op_rsize_bop = (nfsd4op_rsize)nfsd4_setattr_rsize,
1581 }, 1584 },
1582 [OP_SETCLIENTID] = { 1585 [OP_SETCLIENTID] = {
1583 .op_func = (nfsd4op_func)nfsd4_setclientid, 1586 .op_func = (nfsd4op_func)nfsd4_setclientid,
1584 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS 1587 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
1585 | OP_MODIFIES_SOMETHING, 1588 | OP_MODIFIES_SOMETHING | OP_CACHEME,
1586 .op_name = "OP_SETCLIENTID", 1589 .op_name = "OP_SETCLIENTID",
1587 .op_cacheresult = true,
1588 .op_rsize_bop = (nfsd4op_rsize)nfsd4_setclientid_rsize, 1590 .op_rsize_bop = (nfsd4op_rsize)nfsd4_setclientid_rsize,
1589 }, 1591 },
1590 [OP_SETCLIENTID_CONFIRM] = { 1592 [OP_SETCLIENTID_CONFIRM] = {
1591 .op_func = (nfsd4op_func)nfsd4_setclientid_confirm, 1593 .op_func = (nfsd4op_func)nfsd4_setclientid_confirm,
1592 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS 1594 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS
1593 | OP_MODIFIES_SOMETHING, 1595 | OP_MODIFIES_SOMETHING | OP_CACHEME,
1594 .op_name = "OP_SETCLIENTID_CONFIRM", 1596 .op_name = "OP_SETCLIENTID_CONFIRM",
1595 .op_cacheresult = true,
1596 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize, 1597 .op_rsize_bop = (nfsd4op_rsize)nfsd4_only_status_rsize,
1597 }, 1598 },
1598 [OP_VERIFY] = { 1599 [OP_VERIFY] = {
@@ -1601,9 +1602,8 @@ static struct nfsd4_operation nfsd4_ops[] = {
1601 }, 1602 },
1602 [OP_WRITE] = { 1603 [OP_WRITE] = {
1603 .op_func = (nfsd4op_func)nfsd4_write, 1604 .op_func = (nfsd4op_func)nfsd4_write,
1604 .op_flags = OP_MODIFIES_SOMETHING, 1605 .op_flags = OP_MODIFIES_SOMETHING | OP_CACHEME,
1605 .op_name = "OP_WRITE", 1606 .op_name = "OP_WRITE",
1606 .op_cacheresult = true,
1607 .op_rsize_bop = (nfsd4op_rsize)nfsd4_write_rsize, 1607 .op_rsize_bop = (nfsd4op_rsize)nfsd4_write_rsize,
1608 }, 1608 },
1609 [OP_RELEASE_LOCKOWNER] = { 1609 [OP_RELEASE_LOCKOWNER] = {