From: "Luís Henriques" <lhenriques@suse.de>
To: Ilya Dryomov <idryomov@gmail.com>
Cc: Jeff Layton <jlayton@kernel.org>,
xiubli@redhat.com, ceph-devel@vger.kernel.org
Subject: Re: [PATCH] ceph: fix error handling in ceph_sync_write
Date: Thu, 25 Aug 2022 10:41:02 +0100 [thread overview]
Message-ID: <YwdDrguhbzhqMPgr@suse.de> (raw)
In-Reply-To: <CAOi1vP9-kOHNjtSY0uEQP0bWwfn17BbiRbeuAmoCf2X9RrFHBA@mail.gmail.com>
On Thu, Aug 25, 2022 at 10:32:56AM +0200, Ilya Dryomov wrote:
> On Wed, Aug 24, 2022 at 10:53 PM Jeff Layton <jlayton@kernel.org> wrote:
> >
> > ceph_sync_write has assumed that a zero result in req->r_result means
> > success. Testing with a recent cluster however shows the OSD returning
> > a non-zero length written here. I'm not sure whether and when this
> > changed, but fix the code to accept either result.
> >
> > Assume a negative result means error, and anything else is a success. If
> > we're given a short length, then return a short write.
> >
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> > fs/ceph/file.c | 10 +++++++++-
> > 1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> > index 86265713a743..c0b2c8968be9 100644
> > --- a/fs/ceph/file.c
> > +++ b/fs/ceph/file.c
> > @@ -1632,11 +1632,19 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
> > req->r_end_latency, len, ret);
> > out:
> > ceph_osdc_put_request(req);
> > - if (ret != 0) {
> > + if (ret < 0) {
> > ceph_set_error_write(ci);
> > break;
> > }
> >
> > + /*
> > + * FIXME: it's unclear whether all OSD versions return the
> > + * length written on a write. For now, assume that a 0 return
> > + * means that everything got written.
> > + */
> > + if (ret && ret < len)
> > + len = ret;
> > +
> > ceph_clear_error_write(ci);
> > pos += len;
> > written += len;
> > --
> > 2.37.2
> >
>
> Hi Jeff,
>
> AFAIK OSDs aren't allowed to return any kind of length on a write
> and there is no such thing as a short write. This definitely needs
> deeper investigation.
>
> What is the cluster version you are testing against?
OK, I'm only seeing 'ret' being set to the write length only when enabling
encryption (i.e. with test_dummy_encryption mount option). So, maybe the
right fix is something like:
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 16dcade66923..5119d87d61fb 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1889,6 +1889,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
ceph_release_page_vector(pages, num_pages);
break;
}
+ ret = 0;
}
req = ceph_osdc_new_request(osdc, &ci->i_layout,
Cheers,
--
Luís
next prev parent reply other threads:[~2022-08-25 9:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-24 20:53 [PATCH] ceph: fix error handling in ceph_sync_write Jeff Layton
2022-08-25 1:22 ` Xiubo Li
2022-08-25 8:32 ` Ilya Dryomov
2022-08-25 9:41 ` Luís Henriques [this message]
2022-08-25 13:18 ` Jeff Layton
2022-08-25 10:56 ` Jeff Layton
2022-08-25 13:16 ` Jeff Layton
2022-08-26 0:07 ` 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=YwdDrguhbzhqMPgr@suse.de \
--to=lhenriques@suse.de \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=xiubli@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.