diff options
author | Andy Adamson <andros@netapp.com> | 2012-11-27 10:34:19 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-12-12 15:36:02 -0500 |
commit | eb96d5c97b0825d542e9c4ba5e0a22b519355166 (patch) | |
tree | 62c98e2bdbcc7334a7043725d1fd81a589a75177 /fs/nfs/nfs4state.c | |
parent | 620038f6d2304475dce800dc5c75fc335a19613a (diff) |
SUNRPC handle EKEYEXPIRED in call_refreshresult
Currently, when an RPCSEC_GSS context has expired or is non-existent
and the users (Kerberos) credentials have also expired or are non-existent,
the client receives the -EKEYEXPIRED error and tries to refresh the context
forever. If an application is performing I/O, or other work against the share,
the application hangs, and the user is not prompted to refresh/establish their
credentials. This can result in a denial of service for other users.
Users are expected to manage their Kerberos credential lifetimes to mitigate
this issue.
Move the -EKEYEXPIRED handling into the RPC layer. Try tk_cred_retry number
of times to refresh the gss_context, and then return -EACCES to the application.
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r-- | fs/nfs/nfs4state.c | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 78e90a80fc3a..8dcbd9a0367d 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1437,14 +1437,6 @@ restart: | |||
1437 | /* Mark the file as being 'closed' */ | 1437 | /* Mark the file as being 'closed' */ |
1438 | state->state = 0; | 1438 | state->state = 0; |
1439 | break; | 1439 | break; |
1440 | case -EKEYEXPIRED: | ||
1441 | /* | ||
1442 | * User RPCSEC_GSS context has expired. | ||
1443 | * We cannot recover this stateid now, so | ||
1444 | * skip it and allow recovery thread to | ||
1445 | * proceed. | ||
1446 | */ | ||
1447 | break; | ||
1448 | case -NFS4ERR_ADMIN_REVOKED: | 1440 | case -NFS4ERR_ADMIN_REVOKED: |
1449 | case -NFS4ERR_STALE_STATEID: | 1441 | case -NFS4ERR_STALE_STATEID: |
1450 | case -NFS4ERR_BAD_STATEID: | 1442 | case -NFS4ERR_BAD_STATEID: |
@@ -1597,14 +1589,6 @@ static void nfs4_state_start_reclaim_nograce(struct nfs_client *clp) | |||
1597 | nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_nograce); | 1589 | nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_nograce); |
1598 | } | 1590 | } |
1599 | 1591 | ||
1600 | static void nfs4_warn_keyexpired(const char *s) | ||
1601 | { | ||
1602 | printk_ratelimited(KERN_WARNING "Error: state manager" | ||
1603 | " encountered RPCSEC_GSS session" | ||
1604 | " expired against NFSv4 server %s.\n", | ||
1605 | s); | ||
1606 | } | ||
1607 | |||
1608 | static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) | 1592 | static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) |
1609 | { | 1593 | { |
1610 | switch (error) { | 1594 | switch (error) { |
@@ -1638,10 +1622,6 @@ static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) | |||
1638 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: | 1622 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: |
1639 | set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); | 1623 | set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); |
1640 | break; | 1624 | break; |
1641 | case -EKEYEXPIRED: | ||
1642 | /* Nothing we can do */ | ||
1643 | nfs4_warn_keyexpired(clp->cl_hostname); | ||
1644 | break; | ||
1645 | default: | 1625 | default: |
1646 | dprintk("%s: failed to handle error %d for server %s\n", | 1626 | dprintk("%s: failed to handle error %d for server %s\n", |
1647 | __func__, error, clp->cl_hostname); | 1627 | __func__, error, clp->cl_hostname); |
@@ -1758,8 +1738,6 @@ static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status) | |||
1758 | dprintk("%s: exit with error %d for server %s\n", | 1738 | dprintk("%s: exit with error %d for server %s\n", |
1759 | __func__, -EPROTONOSUPPORT, clp->cl_hostname); | 1739 | __func__, -EPROTONOSUPPORT, clp->cl_hostname); |
1760 | return -EPROTONOSUPPORT; | 1740 | return -EPROTONOSUPPORT; |
1761 | case -EKEYEXPIRED: | ||
1762 | nfs4_warn_keyexpired(clp->cl_hostname); | ||
1763 | case -NFS4ERR_NOT_SAME: /* FixMe: implement recovery | 1741 | case -NFS4ERR_NOT_SAME: /* FixMe: implement recovery |
1764 | * in nfs4_exchange_id */ | 1742 | * in nfs4_exchange_id */ |
1765 | default: | 1743 | default: |
@@ -1912,7 +1890,6 @@ again: | |||
1912 | break; | 1890 | break; |
1913 | 1891 | ||
1914 | case -EKEYEXPIRED: | 1892 | case -EKEYEXPIRED: |
1915 | nfs4_warn_keyexpired(clp->cl_hostname); | ||
1916 | case -NFS4ERR_NOT_SAME: /* FixMe: implement recovery | 1893 | case -NFS4ERR_NOT_SAME: /* FixMe: implement recovery |
1917 | * in nfs4_exchange_id */ | 1894 | * in nfs4_exchange_id */ |
1918 | status = -EKEYEXPIRED; | 1895 | status = -EKEYEXPIRED; |