Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333118
b: refs/heads/master
c: b3c54de
h: refs/heads/master
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Sep 28, 2012
1 parent 4fc4126 commit dca4bc0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a11a2bf4de5679fa0b63474c7d39bea2dac7d061
refs/heads/master: b3c54de6f82d01637796bcc1f667a45f3b32e814
16 changes: 12 additions & 4 deletions trunk/fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,16 +450,20 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov,
ssize_t result = -ENOMEM;
struct inode *inode = iocb->ki_filp->f_mapping->host;
struct nfs_direct_req *dreq;
struct nfs_lock_context *l_ctx;

dreq = nfs_direct_req_alloc();
if (dreq == NULL)
goto out;

dreq->inode = inode;
dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp));
dreq->l_ctx = nfs_get_lock_context(dreq->ctx);
if (dreq->l_ctx == NULL)
l_ctx = nfs_get_lock_context(dreq->ctx);
if (IS_ERR(l_ctx)) {
result = PTR_ERR(l_ctx);
goto out_release;
}
dreq->l_ctx = l_ctx;
if (!is_sync_kiocb(iocb))
dreq->iocb = iocb;

Expand Down Expand Up @@ -849,16 +853,20 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov,
ssize_t result = -ENOMEM;
struct inode *inode = iocb->ki_filp->f_mapping->host;
struct nfs_direct_req *dreq;
struct nfs_lock_context *l_ctx;

dreq = nfs_direct_req_alloc();
if (!dreq)
goto out;

dreq->inode = inode;
dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp));
dreq->l_ctx = nfs_get_lock_context(dreq->ctx);
if (dreq->l_ctx == NULL)
l_ctx = nfs_get_lock_context(dreq->ctx);
if (IS_ERR(l_ctx)) {
result = PTR_ERR(l_ctx);
goto out_release;
}
dreq->l_ctx = l_ctx;
if (!is_sync_kiocb(iocb))
dreq->iocb = iocb;

Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/nfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx)
spin_unlock(&inode->i_lock);
new = kmalloc(sizeof(*new), GFP_KERNEL);
if (new == NULL)
return NULL;
return ERR_PTR(-ENOMEM);
nfs_init_lock_context(new);
spin_lock(&inode->i_lock);
res = __nfs_find_lock_context(ctx);
Expand Down
8 changes: 5 additions & 3 deletions trunk/fs/nfs/pagelist.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,20 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
unsigned int offset, unsigned int count)
{
struct nfs_page *req;
struct nfs_lock_context *l_ctx;

/* try to allocate the request struct */
req = nfs_page_alloc();
if (req == NULL)
return ERR_PTR(-ENOMEM);

/* get lock context early so we can deal with alloc failures */
req->wb_lock_context = nfs_get_lock_context(ctx);
if (req->wb_lock_context == NULL) {
l_ctx = nfs_get_lock_context(ctx);
if (IS_ERR(l_ctx)) {
nfs_page_free(req);
return ERR_PTR(-ENOMEM);
return ERR_CAST(l_ctx);
}
req->wb_lock_context = l_ctx;

/* Initialize the request struct. Initially, we assume a
* long write-back delay. This will be adjusted in
Expand Down

0 comments on commit dca4bc0

Please sign in to comment.