Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
  net/9p: Handle get_user_pages_fast return properly
This commit is contained in:
Linus Torvalds 2011-05-10 09:39:11 -07:00
commit 622b9f1524
2 changed files with 4 additions and 9 deletions

View file

@ -614,7 +614,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
err = c->trans_mod->request(c, req); err = c->trans_mod->request(c, req);
if (err < 0) { if (err < 0) {
if (err != -ERESTARTSYS) if (err != -ERESTARTSYS && err != -EFAULT)
c->status = Disconnected; c->status = Disconnected;
goto reterr; goto reterr;
} }

View file

@ -63,7 +63,7 @@ p9_payload_gup(struct p9_req_t *req, size_t *pdata_off, int *pdata_len,
int nr_pages, u8 rw) int nr_pages, u8 rw)
{ {
uint32_t first_page_bytes = 0; uint32_t first_page_bytes = 0;
uint32_t pdata_mapped_pages; int32_t pdata_mapped_pages;
struct trans_rpage_info *rpinfo; struct trans_rpage_info *rpinfo;
*pdata_off = (__force size_t)req->tc->pubuf & (PAGE_SIZE-1); *pdata_off = (__force size_t)req->tc->pubuf & (PAGE_SIZE-1);
@ -75,14 +75,9 @@ p9_payload_gup(struct p9_req_t *req, size_t *pdata_off, int *pdata_len,
rpinfo = req->tc->private; rpinfo = req->tc->private;
pdata_mapped_pages = get_user_pages_fast((unsigned long)req->tc->pubuf, pdata_mapped_pages = get_user_pages_fast((unsigned long)req->tc->pubuf,
nr_pages, rw, &rpinfo->rp_data[0]); nr_pages, rw, &rpinfo->rp_data[0]);
if (pdata_mapped_pages <= 0)
return pdata_mapped_pages;
if (pdata_mapped_pages < 0) {
printk(KERN_ERR "get_user_pages_fast failed:%d udata:%p"
"nr_pages:%d\n", pdata_mapped_pages,
req->tc->pubuf, nr_pages);
pdata_mapped_pages = 0;
return -EIO;
}
rpinfo->rp_nr_pages = pdata_mapped_pages; rpinfo->rp_nr_pages = pdata_mapped_pages;
if (*pdata_off) { if (*pdata_off) {
*pdata_len = first_page_bytes; *pdata_len = first_page_bytes;