WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
list_del_init(&lseg->pls_list);
- if (list_empty(&lo->plh_segs)) {
+ if (list_empty(&lo->plh_segs))
set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
- /* Matched by initial refcount set in alloc_init_layout_hdr */
- pnfs_put_layout_hdr_locked(lo);
- }
rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq);
}
dprintk("%s:Begin lo %p\n", __func__, lo);
if (list_empty(&lo->plh_segs)) {
- if (!test_and_set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags))
- pnfs_put_layout_hdr_locked(lo);
+ set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
return 0;
}
list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list)
if (nfsi->layout) {
if (test_bit(NFS_LAYOUT_DESTROYED, &nfsi->layout->plh_flags))
return NULL;
- else
- return nfsi->layout;
+ pnfs_get_layout_hdr(nfsi->layout);
+ return nfsi->layout;
}
spin_unlock(&ino->i_lock);
new = alloc_init_layout_hdr(ino, ctx, gfp_flags);
goto out_unlock;
atomic_inc(&lo->plh_outstanding);
- pnfs_get_layout_hdr(lo);
if (list_empty(&lo->plh_segs))
first = true;