@@ -430,6 +430,25 @@ static int nfs_end_delegation_return(struct inode
*inode, struct nfs_delegation
goto out;
err = nfs_do_return_delegation(inode, delegation, issync);
+ if (err == -EIO) {
+ struct file_lock *fl;
+ struct file_lock_context *flctx = inode->i_flctx;
+ struct list_head *list;
+
+ if (flctx == NULL)
+ goto out;
+
+ /* mark all locks lost */
+ list = &flctx->flc_posix;
+ down_write(&nfsi->rwsem);
+ spin_lock(&flctx->flc_lock);
+ list_for_each_entry(fl, list, fl_list) {
+ set_bit(NFS_LOCK_LOST,
+ &fl->fl_u.nfs4_fl.owner->ls_flags);
+ }
+ spin_unlock(&flctx->flc_lock);
+ up_write(&nfsi->rwsem);
+ }
out:
return err;
}
@@ -490,7 +509,7 @@ restart:
delegation = nfs_start_delegation_return_locked(NFS_I(inode));
rcu_read_unlock();
- err = nfs_end_delegation_return(inode, delegation, 0);
+ err = nfs_end_delegation_return(inode, delegation, 1);
iput(inode);
nfs_sb_deactive(server->super);
if (!err)
@@ -5309,13 +5309,13 @@ static void nfs4_delegreturn_done(struct
rpc_task *task, void *calldata)
switch (task->tk_status) {
case 0:
renew_lease(data->res.server, data->timestamp);
- case -NFS4ERR_ADMIN_REVOKED:
- case -NFS4ERR_DELEG_REVOKED:
case -NFS4ERR_BAD_STATEID:
case -NFS4ERR_OLD_STATEID:
case -NFS4ERR_STALE_STATEID:
case -NFS4ERR_EXPIRED:
task->tk_status = 0;
+ case -NFS4ERR_ADMIN_REVOKED:
+ case -NFS4ERR_DELEG_REVOKED:
if (data->roc)
pnfs_roc_set_barrier(data->inode, data->roc_barrier);