Skip to content

Commit a0e3390

Browse files
committed
Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
* 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6: nfs4: The difference of 2 pointers is ptrdiff_t nfs: testing the wrong variable nfs: handle lock context allocation failures in nfs_create_request Fixed Regression in NFS Direct I/O path
2 parents 2d3b07c + 12364a4 commit a0e3390

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

fs/nfs/direct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov,
873873
dreq->inode = inode;
874874
dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp));
875875
dreq->l_ctx = nfs_get_lock_context(dreq->ctx);
876-
if (dreq->l_ctx != NULL)
876+
if (dreq->l_ctx == NULL)
877877
goto out_release;
878878
if (!is_sync_kiocb(iocb))
879879
dreq->iocb = iocb;

fs/nfs/idmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static ssize_t nfs_idmap_get_desc(const char *name, size_t namelen,
123123
size_t desclen = typelen + namelen + 2;
124124

125125
*desc = kmalloc(desclen, GFP_KERNEL);
126-
if (!desc)
126+
if (!*desc)
127127
return -ENOMEM;
128128

129129
cp = *desc;

fs/nfs/nfs4proc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *
429429
* returned NFS4ERR_DELAY as per Section 2.10.6.2
430430
* of RFC5661.
431431
*/
432-
dprintk("%s: slot=%ld seq=%d: Operation in progress\n",
432+
dprintk("%s: slot=%td seq=%d: Operation in progress\n",
433433
__func__,
434434
res->sr_slot - res->sr_session->fc_slot_table.slots,
435435
res->sr_slot->seq_nr);
@@ -573,7 +573,7 @@ int nfs4_setup_sequence(const struct nfs_server *server,
573573
goto out;
574574
}
575575

576-
dprintk("--> %s clp %p session %p sr_slot %ld\n",
576+
dprintk("--> %s clp %p session %p sr_slot %td\n",
577577
__func__, session->clp, session, res->sr_slot ?
578578
res->sr_slot - session->fc_slot_table.slots : -1);
579579

fs/nfs/pagelist.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
6565
if (req == NULL)
6666
return ERR_PTR(-ENOMEM);
6767

68+
/* get lock context early so we can deal with alloc failures */
69+
req->wb_lock_context = nfs_get_lock_context(ctx);
70+
if (req->wb_lock_context == NULL) {
71+
nfs_page_free(req);
72+
return ERR_PTR(-ENOMEM);
73+
}
74+
6875
/* Initialize the request struct. Initially, we assume a
6976
* long write-back delay. This will be adjusted in
7077
* update_nfs_request below if the region is not locked. */
@@ -79,7 +86,6 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
7986
req->wb_pgbase = offset;
8087
req->wb_bytes = count;
8188
req->wb_context = get_nfs_open_context(ctx);
82-
req->wb_lock_context = nfs_get_lock_context(ctx);
8389
kref_init(&req->wb_kref);
8490
return req;
8591
}

0 commit comments

Comments
 (0)