All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiubo Li <xiubli@redhat.com>
To: jlayton@kernel.org
Cc: idryomov@gmail.com, vshankar@redhat.com,
	ceph-devel@vger.kernel.org, Xiubo Li <xiubli@redhat.com>
Subject: [PATCH] ceph: redirty the folio/page when offset and size are not aligned
Date: Thu,  5 May 2022 18:58:08 +0800	[thread overview]
Message-ID: <20220505105808.35214-1-xiubli@redhat.com> (raw)

At the same time fix another buggy code because in writepages_finish
if the opcode doesn't equal to CEPH_OSD_OP_WRITE the request memory
must have been corrupted.

URL: https://tracker.ceph.com/issues/55421
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/addr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index e52b62407b10..ae224135440b 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -146,6 +146,8 @@ static void ceph_invalidate_folio(struct folio *folio, size_t offset,
 	if (offset != 0 || length != folio_size(folio)) {
 		dout("%p invalidate_folio idx %lu partial dirty page %zu~%zu\n",
 		     inode, folio->index, offset, length);
+		filemap_dirty_folio(folio->mapping, folio);
+		folio_account_redirty(folio);
 		return;
 	}
 
@@ -733,8 +735,7 @@ static void writepages_finish(struct ceph_osd_request *req)
 
 	/* clean all pages */
 	for (i = 0; i < req->r_num_ops; i++) {
-		if (req->r_ops[i].op != CEPH_OSD_OP_WRITE)
-			break;
+		BUG_ON(req->r_ops[i].op != CEPH_OSD_OP_WRITE);
 
 		osd_data = osd_req_op_extent_osd_data(req, i);
 		BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES);
-- 
2.36.0.rc1


             reply	other threads:[~2022-05-05 10:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 10:58 Xiubo Li [this message]
2022-05-05 11:32 ` [PATCH] ceph: redirty the folio/page when offset and size are not aligned Jeff Layton
2022-05-05 11:58   ` Xiubo Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220505105808.35214-1-xiubli@redhat.com \
    --to=xiubli@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=vshankar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.