|
@@ -46,6 +46,39 @@
|
|
|
|
|
|
#define NFSDBG_FACILITY NFSDBG_PROC
|
|
#define NFSDBG_FACILITY NFSDBG_PROC
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * wrapper to handle the -EKEYEXPIRED error message. This should generally
|
|
|
|
+ * only happen if using krb5 auth and a user's TGT expires. NFSv2 doesn't
|
|
|
|
+ * support the NFSERR_JUKEBOX error code, but we handle this situation in the
|
|
|
|
+ * same way that we handle that error with NFSv3.
|
|
|
|
+ */
|
|
|
|
+static int
|
|
|
|
+nfs_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
|
|
|
|
+{
|
|
|
|
+ int res;
|
|
|
|
+ do {
|
|
|
|
+ res = rpc_call_sync(clnt, msg, flags);
|
|
|
|
+ if (res != -EKEYEXPIRED)
|
|
|
|
+ break;
|
|
|
|
+ schedule_timeout_killable(NFS_JUKEBOX_RETRY_TIME);
|
|
|
|
+ res = -ERESTARTSYS;
|
|
|
|
+ } while (!fatal_signal_pending(current));
|
|
|
|
+ return res;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#define rpc_call_sync(clnt, msg, flags) nfs_rpc_wrapper(clnt, msg, flags)
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+nfs_async_handle_expired_key(struct rpc_task *task)
|
|
|
|
+{
|
|
|
|
+ if (task->tk_status != -EKEYEXPIRED)
|
|
|
|
+ return 0;
|
|
|
|
+ task->tk_status = 0;
|
|
|
|
+ rpc_restart_call(task);
|
|
|
|
+ rpc_delay(task, NFS_JUKEBOX_RETRY_TIME);
|
|
|
|
+ return 1;
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Bare-bones access to getattr: this is for nfs_read_super.
|
|
* Bare-bones access to getattr: this is for nfs_read_super.
|
|
*/
|
|
*/
|
|
@@ -307,6 +340,8 @@ nfs_proc_unlink_setup(struct rpc_message *msg, struct inode *dir)
|
|
|
|
|
|
static int nfs_proc_unlink_done(struct rpc_task *task, struct inode *dir)
|
|
static int nfs_proc_unlink_done(struct rpc_task *task, struct inode *dir)
|
|
{
|
|
{
|
|
|
|
+ if (nfs_async_handle_expired_key(task))
|
|
|
|
+ return 0;
|
|
nfs_mark_for_revalidate(dir);
|
|
nfs_mark_for_revalidate(dir);
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
@@ -560,6 +595,9 @@ nfs_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
|
|
|
|
|
|
static int nfs_read_done(struct rpc_task *task, struct nfs_read_data *data)
|
|
static int nfs_read_done(struct rpc_task *task, struct nfs_read_data *data)
|
|
{
|
|
{
|
|
|
|
+ if (nfs_async_handle_expired_key(task))
|
|
|
|
+ return -EAGAIN;
|
|
|
|
+
|
|
nfs_invalidate_atime(data->inode);
|
|
nfs_invalidate_atime(data->inode);
|
|
if (task->tk_status >= 0) {
|
|
if (task->tk_status >= 0) {
|
|
nfs_refresh_inode(data->inode, data->res.fattr);
|
|
nfs_refresh_inode(data->inode, data->res.fattr);
|
|
@@ -579,6 +617,9 @@ static void nfs_proc_read_setup(struct nfs_read_data *data, struct rpc_message *
|
|
|
|
|
|
static int nfs_write_done(struct rpc_task *task, struct nfs_write_data *data)
|
|
static int nfs_write_done(struct rpc_task *task, struct nfs_write_data *data)
|
|
{
|
|
{
|
|
|
|
+ if (nfs_async_handle_expired_key(task))
|
|
|
|
+ return -EAGAIN;
|
|
|
|
+
|
|
if (task->tk_status >= 0)
|
|
if (task->tk_status >= 0)
|
|
nfs_post_op_update_inode_force_wcc(data->inode, data->res.fattr);
|
|
nfs_post_op_update_inode_force_wcc(data->inode, data->res.fattr);
|
|
return 0;
|
|
return 0;
|