Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #60480 > unrolled thread

[PATCH] ceph: only dirty ITER_IOVEC pages for direct read

Started by"Yan, Zheng" <zyan@redhat.com>
First post2018-03-16 05:00 +0100
Last post2018-03-16 06:40 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.debian.kernel


Contents

  [PATCH] ceph: only dirty ITER_IOVEC pages for direct read "Yan, Zheng" <zyan@redhat.com> - 2018-03-16 05:00 +0100
    Re: [PATCH] ceph: only dirty ITER_IOVEC pages for direct read Eric Biggers <ebiggers3@gmail.com> - 2018-03-16 05:00 +0100
      Re: [PATCH] ceph: only dirty ITER_IOVEC pages for direct read "Yan, Zheng" <ukernel@gmail.com> - 2018-03-16 06:40 +0100

#60480 — [PATCH] ceph: only dirty ITER_IOVEC pages for direct read

From"Yan, Zheng" <zyan@redhat.com>
Date2018-03-16 05:00 +0100
Subject[PATCH] ceph: only dirty ITER_IOVEC pages for direct read
Message-ID<vtOH8-54U-5@gated-at.bofh.it>
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
---
 fs/ceph/file.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 1e9dbe77a880..fef8968011ee 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -614,7 +614,8 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *to,
 struct ceph_aio_request {
 	struct kiocb *iocb;
 	size_t total_len;
-	int write;
+	bool write;
+	bool should_dirty;
 	int error;
 	struct list_head osd_reqs;
 	unsigned int num_reqs;
@@ -724,7 +725,7 @@ static void ceph_aio_complete_req(struct ceph_osd_request *req)
 		}
 	}
 
-	ceph_put_page_vector(osd_data->pages, num_pages, !aio_req->write);
+	ceph_put_page_vector(osd_data->pages, num_pages, aio_req->should_dirty);
 	ceph_osdc_put_request(req);
 
 	if (rc < 0)
@@ -821,6 +822,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
 	size_t count = iov_iter_count(iter);
 	loff_t pos = iocb->ki_pos;
 	bool write = iov_iter_rw(iter) == WRITE;
+	bool should_dirty = !write && iter_is_iovec(iter);
 
 	if (write && ceph_snap(file_inode(file)) != CEPH_NOSNAP)
 		return -EROFS;
@@ -888,6 +890,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
 			if (aio_req) {
 				aio_req->iocb = iocb;
 				aio_req->write = write;
+				aio_req->should_dirty = should_dirty;
 				INIT_LIST_HEAD(&aio_req->osd_reqs);
 				if (write) {
 					aio_req->mtime = mtime;
@@ -945,7 +948,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
 				len = ret;
 		}
 
-		ceph_put_page_vector(pages, num_pages, !write);
+		ceph_put_page_vector(pages, num_pages, should_dirty);
 
 		ceph_osdc_put_request(req);
 		if (ret < 0)
-- 
2.13.6

[toc] | [next] | [standalone]


#60481

FromEric Biggers <ebiggers3@gmail.com>
Date2018-03-16 05:00 +0100
Message-ID<vtOH8-54U-3@gated-at.bofh.it>
In reply to#60480
Hi Yan,

On Fri, Mar 16, 2018 at 11:32:12AM +0800, Yan, Zheng wrote:
> Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
> ---
>  fs/ceph/file.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 

Fixes for use-after-free bugs should be marked for stable.  The commit message
should also explain what is being fixed, exactly.  Mentioning that this bug was
found by syzkaller would also be useful, since people are looking out for those.

Thanks,

Eric

[toc] | [prev] | [next] | [standalone]


#60482

From"Yan, Zheng" <ukernel@gmail.com>
Date2018-03-16 06:40 +0100
Message-ID<vtQfU-6Fg-5@gated-at.bofh.it>
In reply to#60481
On Fri, Mar 16, 2018 at 11:40 AM, Eric Biggers <ebiggers3@gmail.com> wrote:
> Hi Yan,
>
> On Fri, Mar 16, 2018 at 11:32:12AM +0800, Yan, Zheng wrote:
>> Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
>> ---
>>  fs/ceph/file.c | 9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>
> Fixes for use-after-free bugs should be marked for stable.  The commit message
> should also explain what is being fixed, exactly.  Mentioning that this bug was
> found by syzkaller would also be useful, since people are looking out for those.
>

I added Reported-by and CC stale to  the patch in our testing branch

https://github.com/ceph/ceph-client/commit/cfcd7a9e2d7faf5601b4731ea5a9eff7751981aa

Regards
Yan, Zheng


> Thanks,
>
> Eric
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.kernel


csiph-web