static void nfs4_put_deleg_lease(struct nfs4_file *fp)
{
- lockdep_assert_held(&state_lock);
+ struct file *filp = NULL;
+ struct file_lock *fl;
- if (!fp->fi_lease)
- return;
- if (atomic_dec_and_test(&fp->fi_delegees)) {
- vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease);
+ spin_lock(&fp->fi_lock);
+ if (fp->fi_lease && atomic_dec_and_test(&fp->fi_delegees)) {
+ swap(filp, fp->fi_deleg_file);
+ fl = fp->fi_lease;
fp->fi_lease = NULL;
- fput(fp->fi_deleg_file);
- fp->fi_deleg_file = NULL;
+ }
+ spin_unlock(&fp->fi_lock);
+
+ if (filp) {
+ vfs_setlease(filp, F_UNLCK, &fl);
+ fput(filp);
}
}
list_del_init(&dp->dl_recall_lru);
list_del_init(&dp->dl_perfile);
spin_unlock(&fp->fi_lock);
- if (fp)
- nfs4_put_deleg_lease(fp);
+ nfs4_put_deleg_lease(fp);
}
static void destroy_delegation(struct nfs4_delegation *dp)