@@ -5607,7 +5607,7 @@ static void nfs4_layoutreturn_release(void *calldata)
spin_lock(&ino->i_lock);
lo->plh_block_lgets--;
- lo->plh_outstanding--;
+ atomic_dec(&lo->plh_outstanding);
spin_unlock(&ino->i_lock);
put_layout_hdr(ino);
}
@@ -5644,7 +5644,7 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool issync)
/* FIXME we should test for BULK here */
spin_lock(&lo->inode->i_lock);
BUG_ON(lo->plh_block_lgets == 0);
- lo->plh_outstanding++;
+ atomic_inc(&lo->plh_outstanding);
spin_unlock(&lo->inode->i_lock);
}
task = rpc_run_task(&task_setup_data);
@@ -505,7 +505,8 @@ pnfs_layoutgets_blocked(struct pnfs_layout_hdr *lo, nfs4_stateid *stateid,
return true;
return lo->plh_block_lgets ||
test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) ||
- (list_empty(&lo->segs) && (lo->plh_outstanding > lget));
+ (list_empty(&lo->segs) &&
+ (atomic_read(&lo->plh_outstanding) > lget));
}
int
@@ -868,7 +869,7 @@ pnfs_update_layout(struct inode *ino,
if (pnfs_layoutgets_blocked(lo, NULL, 0))
goto out_unlock;
- lo->plh_outstanding++;
+ atomic_inc(&lo->plh_outstanding);
get_layout_hdr(lo); /* Matched in pnfs_layoutget_release */
if (list_empty(&lo->segs)) {
@@ -883,18 +884,18 @@ pnfs_update_layout(struct inode *ino,
spin_unlock(&ino->i_lock);
lseg = send_layoutget(lo, ctx, &arg);
- spin_lock(&ino->i_lock);
if (!lseg) {
+ spin_lock(&ino->i_lock);
if (list_empty(&lo->segs)) {
spin_lock(&clp->cl_lock);
list_del_init(&lo->layouts);
spin_unlock(&clp->cl_lock);
clear_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags);
}
+ spin_unlock(&ino->i_lock);
}
- lo->plh_outstanding--;
+ atomic_dec(&lo->plh_outstanding);
put_layout_hdr(ino);
- spin_unlock(&ino->i_lock);
out:
dprintk("%s end, state 0x%lx lseg %p\n", __func__,
nfsi->layout->plh_flags, lseg);
@@ -100,7 +100,7 @@ struct pnfs_layout_hdr {
struct list_head segs; /* layout segments list */
int roc_iomode;/* return on close iomode, 0=none */
nfs4_stateid stateid;
- unsigned long plh_outstanding; /* number of RPCs out */
+ atomic_t plh_outstanding; /* number of RPCs out */
unsigned long plh_block_lgets; /* block LAYOUTGET if >0 */
u32 plh_barrier; /* ignore lower seqids */
unsigned long plh_flags;