diff options
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r-- | fs/nfs/write.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 586726a590d8..c1452f838131 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -1233,9 +1233,12 @@ int | |||
1233 | nfs_key_timeout_notify(struct file *filp, struct inode *inode) | 1233 | nfs_key_timeout_notify(struct file *filp, struct inode *inode) |
1234 | { | 1234 | { |
1235 | struct nfs_open_context *ctx = nfs_file_open_context(filp); | 1235 | struct nfs_open_context *ctx = nfs_file_open_context(filp); |
1236 | struct rpc_auth *auth = NFS_SERVER(inode)->client->cl_auth; | ||
1237 | 1236 | ||
1238 | return rpcauth_key_timeout_notify(auth, ctx->cred); | 1237 | if (nfs_ctx_key_to_expire(ctx, inode) && |
1238 | !ctx->ll_cred) | ||
1239 | /* Already expired! */ | ||
1240 | return -EACCES; | ||
1241 | return 0; | ||
1239 | } | 1242 | } |
1240 | 1243 | ||
1241 | /* | 1244 | /* |
@@ -1244,8 +1247,23 @@ nfs_key_timeout_notify(struct file *filp, struct inode *inode) | |||
1244 | bool nfs_ctx_key_to_expire(struct nfs_open_context *ctx, struct inode *inode) | 1247 | bool nfs_ctx_key_to_expire(struct nfs_open_context *ctx, struct inode *inode) |
1245 | { | 1248 | { |
1246 | struct rpc_auth *auth = NFS_SERVER(inode)->client->cl_auth; | 1249 | struct rpc_auth *auth = NFS_SERVER(inode)->client->cl_auth; |
1250 | struct rpc_cred *cred = ctx->ll_cred; | ||
1251 | struct auth_cred acred = { | ||
1252 | .cred = ctx->cred->cr_cred, | ||
1253 | }; | ||
1247 | 1254 | ||
1248 | return rpcauth_cred_key_to_expire(auth, ctx->cred); | 1255 | if (cred && !cred->cr_ops->crmatch(&acred, cred, 0)) { |
1256 | put_rpccred(cred); | ||
1257 | ctx->ll_cred = NULL; | ||
1258 | cred = NULL; | ||
1259 | } | ||
1260 | if (!cred) | ||
1261 | cred = auth->au_ops->lookup_cred(auth, &acred, 0); | ||
1262 | if (!cred || IS_ERR(cred)) | ||
1263 | return true; | ||
1264 | ctx->ll_cred = cred; | ||
1265 | return !!(cred->cr_ops->crkey_timeout && | ||
1266 | cred->cr_ops->crkey_timeout(cred)); | ||
1249 | } | 1267 | } |
1250 | 1268 | ||
1251 | /* | 1269 | /* |