Commit badc76dd authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Convert nfs_alloc_seqid() to return an ERR_PTR() if allocation fails

When we relax the sequencing on the NFSv4.1 OPEN/CLOSE code, we will want
to use the value NULL to indicate that no sequencing is needed.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent f95549cf
...@@ -988,7 +988,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, ...@@ -988,7 +988,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry,
goto err_free_p; goto err_free_p;
p->o_arg.seqid = nfs_alloc_seqid(&sp->so_seqid, gfp_mask); p->o_arg.seqid = nfs_alloc_seqid(&sp->so_seqid, gfp_mask);
if (p->o_arg.seqid == NULL) if (IS_ERR(p->o_arg.seqid))
goto err_free_label; goto err_free_label;
nfs_sb_active(dentry->d_sb); nfs_sb_active(dentry->d_sb);
p->dentry = dget(dentry); p->dentry = dget(dentry);
...@@ -2779,7 +2779,7 @@ int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait) ...@@ -2779,7 +2779,7 @@ int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait)
calldata->arg.fh = NFS_FH(state->inode); calldata->arg.fh = NFS_FH(state->inode);
/* Serialization for the sequence id */ /* Serialization for the sequence id */
calldata->arg.seqid = nfs_alloc_seqid(&state->owner->so_seqid, gfp_mask); calldata->arg.seqid = nfs_alloc_seqid(&state->owner->so_seqid, gfp_mask);
if (calldata->arg.seqid == NULL) if (IS_ERR(calldata->arg.seqid))
goto out_free_calldata; goto out_free_calldata;
calldata->arg.fmode = 0; calldata->arg.fmode = 0;
calldata->arg.bitmask = server->cache_consistency_bitmask; calldata->arg.bitmask = server->cache_consistency_bitmask;
...@@ -5517,7 +5517,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock * ...@@ -5517,7 +5517,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
goto out; goto out;
seqid = nfs_alloc_seqid(&lsp->ls_seqid, GFP_KERNEL); seqid = nfs_alloc_seqid(&lsp->ls_seqid, GFP_KERNEL);
status = -ENOMEM; status = -ENOMEM;
if (seqid == NULL) if (IS_ERR(seqid))
goto out; goto out;
task = nfs4_do_unlck(request, nfs_file_open_context(request->fl_file), lsp, seqid); task = nfs4_do_unlck(request, nfs_file_open_context(request->fl_file), lsp, seqid);
status = PTR_ERR(task); status = PTR_ERR(task);
...@@ -5558,10 +5558,10 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, ...@@ -5558,10 +5558,10 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
p->arg.fh = NFS_FH(inode); p->arg.fh = NFS_FH(inode);
p->arg.fl = &p->fl; p->arg.fl = &p->fl;
p->arg.open_seqid = nfs_alloc_seqid(&lsp->ls_state->owner->so_seqid, gfp_mask); p->arg.open_seqid = nfs_alloc_seqid(&lsp->ls_state->owner->so_seqid, gfp_mask);
if (p->arg.open_seqid == NULL) if (IS_ERR(p->arg.open_seqid))
goto out_free; goto out_free;
p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid, gfp_mask); p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid, gfp_mask);
if (p->arg.lock_seqid == NULL) if (IS_ERR(p->arg.lock_seqid))
goto out_free_seqid; goto out_free_seqid;
p->arg.lock_stateid = &lsp->ls_stateid; p->arg.lock_stateid = &lsp->ls_stateid;
p->arg.lock_owner.clientid = server->nfs_client->cl_clientid; p->arg.lock_owner.clientid = server->nfs_client->cl_clientid;
......
...@@ -1003,11 +1003,11 @@ struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter, gfp_t gfp_m ...@@ -1003,11 +1003,11 @@ struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter, gfp_t gfp_m
struct nfs_seqid *new; struct nfs_seqid *new;
new = kmalloc(sizeof(*new), gfp_mask); new = kmalloc(sizeof(*new), gfp_mask);
if (new != NULL) { if (new == NULL)
return ERR_PTR(-ENOMEM);
new->sequence = counter; new->sequence = counter;
INIT_LIST_HEAD(&new->list); INIT_LIST_HEAD(&new->list);
new->task = NULL; new->task = NULL;
}
return new; return new;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment