Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfsd4: rearrange exchange_id logic to simplify

Minor cleanup: it's simpler to have separate code paths for the update
and non-update cases.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>

+20 -20
+20 -20
fs/nfsd/nfs4state.c
··· 1557 1557 bool creds_match = same_creds(&conf->cl_cred, &rqstp->rq_cred); 1558 1558 bool verfs_match = same_verf(&verf, &conf->cl_verifier); 1559 1559 1560 - if (!clp_used_exchangeid(conf)) { 1561 - if (update) { /* buggy client */ 1560 + if (update) { 1561 + if (!clp_used_exchangeid(conf)) { /* buggy client */ 1562 1562 status = nfserr_inval; 1563 1563 goto out; 1564 1564 } 1565 - } 1566 - if (!creds_match) { /* case 9 */ 1567 - if (update) 1565 + if (!creds_match) { /* case 9 */ 1568 1566 status = nfserr_perm; 1569 - else /* case 3 */ 1570 - status = nfserr_clid_inuse; 1571 - goto out; 1572 - } 1573 - if (!verfs_match) { /* case 8 */ 1574 - if (update) { 1567 + goto out; 1568 + } 1569 + if (!verfs_match) { /* case 8 */ 1575 1570 status = nfserr_not_same; 1576 1571 goto out; 1577 1572 } 1578 - /* case 5, client reboot */ 1579 - expire_client(conf); 1580 - goto out_new; 1573 + /* case 6 */ 1574 + exid->flags |= EXCHGID4_FLAG_CONFIRMED_R; 1575 + new = conf; 1576 + goto out_copy; 1581 1577 } 1582 - if (!clp_used_exchangeid(conf)) { 1583 - status = nfserr_inval; 1578 + if (!creds_match) { /* case 3 */ 1579 + status = nfserr_clid_inuse; 1584 1580 goto out; 1585 1581 } 1586 - /* case 2 */ 1587 - exid->flags |= EXCHGID4_FLAG_CONFIRMED_R; 1588 - new = conf; 1589 - goto out_copy; 1582 + if (verfs_match) { /* case 2 */ 1583 + exid->flags |= EXCHGID4_FLAG_CONFIRMED_R; 1584 + new = conf; 1585 + goto out_copy; 1586 + } 1587 + /* case 5, client reboot */ 1588 + expire_client(conf); 1589 + goto out_new; 1590 1590 } 1591 1591 1592 1592 if (update) { /* case 7 */