<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/net/ceph/osd_client.c, branch linux-4.4.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-4.4.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-4.4.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2016-03-03T23:07:26+00:00</updated>
<entry>
<title>libceph: don't spam dmesg with stray reply warnings</title>
<updated>2016-03-03T23:07:26+00:00</updated>
<author>
<name>Ilya Dryomov</name>
<email>idryomov@gmail.com</email>
</author>
<published>2016-02-19T10:38:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=01c3c0f921c8a2743e3d066108081c14618ee98c'/>
<id>urn:sha1:01c3c0f921c8a2743e3d066108081c14618ee98c</id>
<content type='text'>
commit cd8140c673d9ba9be3591220e1b2226d9e1e40d3 upstream.

Commit d15f9d694b77 ("libceph: check data_len in -&gt;alloc_msg()")
mistakenly bumped the log level on the "tid %llu unknown, skipping"
message.  Turn it back into a dout() - stray replies are perfectly
normal when OSDs flap, crash, get killed for testing purposes, etc.

Signed-off-by: Ilya Dryomov &lt;idryomov@gmail.com&gt;
Reviewed-by: Alex Elder &lt;elder@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>libceph: clear msg-&gt;con in ceph_msg_release() only</title>
<updated>2015-11-02T22:37:46+00:00</updated>
<author>
<name>Ilya Dryomov</name>
<email>idryomov@gmail.com</email>
</author>
<published>2015-11-02T16:13:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=583d0fef756a7615e50f0f68ea0892a497d03971'/>
<id>urn:sha1:583d0fef756a7615e50f0f68ea0892a497d03971</id>
<content type='text'>
The following bit in ceph_msg_revoke_incoming() is unsafe:

    struct ceph_connection *con = msg-&gt;con;
    if (!con)
            return;
    mutex_lock(&amp;con-&gt;mutex);
    &lt;more msg-&gt;con use&gt;

There is nothing preventing con from getting destroyed right after
msg-&gt;con test.  One easy way to reproduce this is to disable message
signing only on the server side and try to map an image.  The system
will go into a

    libceph: read_partial_message ffff880073f0ab68 signature check failed
    libceph: osd0 192.168.255.155:6801 bad crc/signature
    libceph: read_partial_message ffff880073f0ab68 signature check failed
    libceph: osd0 192.168.255.155:6801 bad crc/signature

loop which has to be interrupted with Ctrl-C.  Hit Ctrl-C and you are
likely to end up with a random GP fault if the reset handler executes
"within" ceph_msg_revoke_incoming():

                     &lt;yet another reply w/o a signature&gt;
                                   ...
          &lt;Ctrl-C&gt;
    rbd_obj_request_end
      ceph_osdc_cancel_request
        __unregister_request
          ceph_osdc_put_request
            ceph_msg_revoke_incoming
                                   ...
                                osd_reset
                                  __kick_osd_requests
                                    __reset_osd
                                      remove_osd
                                        ceph_con_close
                                          reset_connection
                                            &lt;clear con-&gt;in_msg-&gt;con&gt;
                                            &lt;put con ref&gt;
                                              put_osd
                                                &lt;free osd/con&gt;
              &lt;msg-&gt;con use&gt; &lt;-- !!!

If ceph_msg_revoke_incoming() executes "before" the reset handler,
osd/con will be leaked because ceph_msg_revoke_incoming() clears
con-&gt;in_msg but doesn't put con ref, while reset_connection() only puts
con ref if con-&gt;in_msg != NULL.

The current msg-&gt;con scheme was introduced by commits 38941f8031bf
("libceph: have messages point to their connection") and 92ce034b5a74
("libceph: have messages take a connection reference"), which defined
when messages get associated with a connection and when that
association goes away.  Part of the problem is that this association is
supposed to go away in much too many places; closing this race entirely
requires either a rework of the existing or an addition of a new layer
of synchronization.

In lieu of that, we can make it *much* less likely to hit by
disassociating messages only on their destruction and resend through
a different connection.  This makes the code simpler and is probably
a good thing to do regardless - this patch adds a msg_con_set() helper
which is is called from only three places: ceph_con_send() and
ceph_con_in_msg_alloc() to set msg-&gt;con and ceph_msg_release() to clear
it.

Signed-off-by: Ilya Dryomov &lt;idryomov@gmail.com&gt;
</content>
</entry>
<entry>
<title>libceph: msg signing callouts don't need con argument</title>
<updated>2015-11-02T22:37:45+00:00</updated>
<author>
<name>Ilya Dryomov</name>
<email>idryomov@gmail.com</email>
</author>
<published>2015-10-26T21:23:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=79dbd1baa651cece408e68a1b445f3628c4b5bdc'/>
<id>urn:sha1:79dbd1baa651cece408e68a1b445f3628c4b5bdc</id>
<content type='text'>
We can use msg-&gt;con instead - at the point we sign an outgoing message
or check the signature on the incoming one, msg-&gt;con is always set.  We
wouldn't know how to sign a message without an associated session (i.e.
msg-&gt;con == NULL) and being able to sign a message using an explicitly
provided authorizer is of no use.

Signed-off-by: Ilya Dryomov &lt;idryomov@gmail.com&gt;
</content>
</entry>
<entry>
<title>libceph: evaluate osd_req_op_data() arguments only once</title>
<updated>2015-11-02T22:36:49+00:00</updated>
<author>
<name>Ioana Ciornei</name>
<email>ciorneiioana@gmail.com</email>
</author>
<published>2015-10-22T15:06:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8a703a383dd3458753e0ad71860ed3a5097692b3'/>
<id>urn:sha1:8a703a383dd3458753e0ad71860ed3a5097692b3</id>
<content type='text'>
This patch changes the osd_req_op_data() macro to not evaluate
arguments more than once in order to follow the kernel coding style.

Signed-off-by: Ioana Ciornei &lt;ciorneiioana@gmail.com&gt;
Reviewed-by: Alex Elder &lt;elder@linaro.org&gt;
[idryomov@gmail.com: changelog, formatting]
Signed-off-by: Ilya Dryomov &lt;idryomov@gmail.com&gt;
</content>
</entry>
<entry>
<title>libceph: remove con argument in handle_reply()</title>
<updated>2015-11-02T22:36:47+00:00</updated>
<author>
<name>Shraddha Barke</name>
<email>shraddha.6596@gmail.com</email>
</author>
<published>2015-10-18T08:25:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=70cf052d0c4b60b6fbb981380660893306b9f172'/>
<id>urn:sha1:70cf052d0c4b60b6fbb981380660893306b9f172</id>
<content type='text'>
Since handle_reply() does not use its con argument, remove it.

Signed-off-by: Shraddha Barke &lt;shraddha.6596@gmail.com&gt;
Signed-off-by: Ilya Dryomov &lt;idryomov@gmail.com&gt;
</content>
</entry>
<entry>
<title>rbd: use writefull op for object size writes</title>
<updated>2015-10-16T14:49:01+00:00</updated>
<author>
<name>Ilya Dryomov</name>
<email>idryomov@gmail.com</email>
</author>
<published>2015-10-07T15:27:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e30b7577bf1d338ca8a273bd2f881de5a41572b7'/>
<id>urn:sha1:e30b7577bf1d338ca8a273bd2f881de5a41572b7</id>
<content type='text'>
This covers only the simplest case - an object size sized write, but
it's still useful in tiering setups when EC is used for the base tier
as writefull op can be proxied, saving an object promotion.

Even though updating ceph_osdc_new_request() to allow writefull should
just be a matter of fixing an assert, I didn't do it because its only
user is cephfs.  All other sites were updated.

Reflects ceph.git commit 7bfb7f9025a8ee0d2305f49bf0336d2424da5b5b.

Signed-off-by: Ilya Dryomov &lt;idryomov@gmail.com&gt;
Reviewed-by: Alex Elder &lt;elder@linaro.org&gt;
</content>
</entry>
<entry>
<title>libceph: check data_len in -&gt;alloc_msg()</title>
<updated>2015-09-09T06:52:17+00:00</updated>
<author>
<name>Ilya Dryomov</name>
<email>idryomov@gmail.com</email>
</author>
<published>2015-09-02T08:37:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d15f9d694b77fe5e4ea12b3031ecaa13b5aa2b10'/>
<id>urn:sha1:d15f9d694b77fe5e4ea12b3031ecaa13b5aa2b10</id>
<content type='text'>
Only -&gt;alloc_msg() should check data_len of the incoming message
against the preallocated ceph_msg, doing it in the messenger is not
right.  The contract is that either -&gt;alloc_msg() returns a ceph_msg
which will fit all of the portions of the incoming message, or it
returns NULL and possibly sets skip, signaling whether NULL is due to
an -ENOMEM.  -&gt;alloc_msg() should be the only place where we make the
skip/no-skip decision.

I stumbled upon this while looking at con/osd ref counting.  Right now,
if we get a non-extent message with a larger data portion than we are
prepared for, -&gt;alloc_msg() returns a ceph_msg, and then, when we skip
it in the messenger, we don't put the con/osd ref acquired in
ceph_con_in_msg_alloc() (which is normally put in process_message()),
so this also fixes a memory leak.

An existing BUG_ON in ceph_msg_data_cursor_init() ensures we don't
corrupt random memory should a buggy -&gt;alloc_msg() return an unfit
ceph_msg.

While at it, I changed the "unknown tid" dout() to a pr_warn() to make
sure all skips are seen and unified format strings.

Signed-off-by: Ilya Dryomov &lt;idryomov@gmail.com&gt;
Reviewed-by: Alex Elder &lt;elder@linaro.org&gt;
</content>
</entry>
<entry>
<title>libceph: store timeouts in jiffies, verify user input</title>
<updated>2015-06-25T08:49:29+00:00</updated>
<author>
<name>Ilya Dryomov</name>
<email>idryomov@gmail.com</email>
</author>
<published>2015-05-15T09:02:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a319bf56a617354e62cf5f774d2ca4e1a8a3bff3'/>
<id>urn:sha1:a319bf56a617354e62cf5f774d2ca4e1a8a3bff3</id>
<content type='text'>
There are currently three libceph-level timeouts that the user can
specify on mount: mount_timeout, osd_idle_ttl and osdkeepalive.  All of
these are in seconds and no checking is done on user input: negative
values are accepted, we multiply them all by HZ which may or may not
overflow, arbitrarily large jiffies then get added together, etc.

There is also a bug in the way mount_timeout=0 is handled.  It's
supposed to mean "infinite timeout", but that's not how wait.h APIs
treat it and so __ceph_open_session() for example will busy loop
without much chance of being interrupted if none of ceph-mons are
there.

Fix all this by verifying user input, storing timeouts capped by
msecs_to_jiffies() in jiffies and using the new ceph_timeout_jiffies()
helper for all user-specified waits to handle infinite timeouts
correctly.

Signed-off-by: Ilya Dryomov &lt;idryomov@gmail.com&gt;
Reviewed-by: Alex Elder &lt;elder@linaro.org&gt;
</content>
</entry>
<entry>
<title>libceph: allow setting osd_req_op's flags</title>
<updated>2015-06-25T08:49:27+00:00</updated>
<author>
<name>Yan, Zheng</name>
<email>zyan@redhat.com</email>
</author>
<published>2015-04-27T03:09:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=144cba1493fdd6e3e1980e439a31df877831ebcd'/>
<id>urn:sha1:144cba1493fdd6e3e1980e439a31df877831ebcd</id>
<content type='text'>
Signed-off-by: Yan, Zheng &lt;zyan@redhat.com&gt;
Reviewed-by: Alex Elder &lt;elder@linaro.org&gt;
</content>
</entry>
<entry>
<title>libceph: properly release STAT request's raw_data_in</title>
<updated>2015-06-25T08:49:27+00:00</updated>
<author>
<name>Yan, Zheng</name>
<email>zyan@redhat.com</email>
</author>
<published>2015-04-27T03:02:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=66ba609f7b96096116ca7bbc21ec6922ea41a992'/>
<id>urn:sha1:66ba609f7b96096116ca7bbc21ec6922ea41a992</id>
<content type='text'>
Signed-off-by: Yan, Zheng &lt;zyan@redhat.com&gt;
Reviewed-by: Alex Elder &lt;elder@linaro.org&gt;
</content>
</entry>
</feed>
