lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1481840034-2113-6-git-send-email-sstabellini@kernel.org>
Date:   Thu, 15 Dec 2016 14:13:53 -0800
From:   Stefano Stabellini <sstabellini@...nel.org>
To:     v9fs-developer@...ts.sourceforge.net
Cc:     sstabellini@...nel.org, ericvh@...il.com, rminnich@...dia.gov,
        lucho@...kov.net, linux-kernel@...r.kernel.org
Subject: [PATCH v2 6/7] 9p: handle large aio read requests

When an async read larger then msize-P9_IOHDRSZ is issued, do not limit
the read size to msize-P9_IOHDRSZ. Instead, keep sending read requests
from the completion function, until the original read is completed.

Signed-off-by: Stefano Stabellini <sstabellini@...nel.org>
---
 net/9p/client.c | 40 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/net/9p/client.c b/net/9p/client.c
index e69955d..8d2f8f7 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1609,14 +1609,52 @@ int p9_client_unlinkat(struct p9_fid *dfid, const char *name, int flags)
 		count -= n;
 	}
 
-	err = total;
 	req->kiocb->ki_pos += total;
+	req->completed += total;
+	req->file_offset += total;
+	req->page_offset += total;
+	err = req->completed;
+
+	if (req->tot_size - req->completed > 0 && total == req->rsize) {
+		struct p9_req_t *req2;
+		u64 rsize = req->tot_size - req->completed;
+		
+		if (rsize > req->fid->iounit)
+			rsize = req->fid->iounit;
+		if (rsize > clnt->msize-P9_IOHDRSZ)
+			rsize = clnt->msize - P9_IOHDRSZ;
+
+		req2 = p9_client_get_req(clnt, P9_TREAD, "dqd", req->fid->fid,
+				req->file_offset, rsize);
+		if (IS_ERR(req2)) {
+			err = PTR_ERR(req2);
+			goto out;
+		}
+		req2->fid = req->fid;
+		req2->rsize = rsize;
+		req2->tot_size = req->tot_size;
+		req2->completed = req->completed;
+		req2->file_offset = req->file_offset;
+		req2->page_offset = req->page_offset;
+		req2->kiocb = req->kiocb;
+		req2->pagevec = req->pagevec;
+		INIT_WORK(&req2->work, p9_client_read_complete);
+
+		err = clnt->trans_mod->request(clnt, req2);
+		if (err < 0) {
+			clnt->status = Disconnected;
+			p9_free_req(clnt, req2);
+			goto out;
+		}
+		goto out2;
+	}
 
 out:
 	req->kiocb->ki_complete(req->kiocb, err, 0);
 
 	release_pages(req->pagevec, (req->tot_size + PAGE_SIZE - 1) / PAGE_SIZE, false);
 	kvfree(req->pagevec);
+out2:
 	p9_free_req(clnt, req);
 }
 
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ