An error occurred fetching the project authors.
  1. 27 Dec, 2016 2 commits
  2. 12 Dec, 2016 3 commits
  3. 04 Apr, 2016 1 commit
    • Kirill A. Shutemov's avatar
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov authored
      PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
      ago with promise that one day it will be possible to implement page
      cache with bigger chunks than PAGE_SIZE.
      
      This promise never materialized.  And unlikely will.
      
      We have many places where PAGE_CACHE_SIZE assumed to be equal to
      PAGE_SIZE.  And it's constant source of confusion on whether
      PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
      especially on the border between fs and mm.
      
      Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
      breakage to be doable.
      
      Let's stop pretending that pages in page cache are special.  They are
      not.
      
      The changes are pretty straight-forward:
      
       - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
      
       - page_cache_get() -> get_page();
      
       - page_cache_release() -> put_page();
      
      This patch contains automated changes generated with coccinelle using
      script below.  For some reason, coccinelle doesn't patch header files.
      I've called spatch for them manually.
      
      The only adjustment after coccinelle is revert of changes to
      PAGE_CAHCE_ALIGN definition: we are going to drop it later.
      
      There are few places in the code where coccinelle didn't reach.  I'll
      fix them manually in a separate patch.  Comments and documentation also
      will be addressed with the separate patch.
      
      virtual patch
      
      @@
      expression E;
      @@
      - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      expression E;
      @@
      - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      @@
      - PAGE_CACHE_SHIFT
      + PAGE_SHIFT
      
      @@
      @@
      - PAGE_CACHE_SIZE
      + PAGE_SIZE
      
      @@
      @@
      - PAGE_CACHE_MASK
      + PAGE_MASK
      
      @@
      expression E;
      @@
      - PAGE_CACHE_ALIGN(E)
      + PAGE_ALIGN(E)
      
      @@
      expression E;
      @@
      - page_cache_get(E)
      + get_page(E)
      
      @@
      expression E;
      @@
      - page_cache_release(E)
      + put_page(E)
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      09cbfeaf
  4. 25 Mar, 2016 2 commits
  5. 24 Feb, 2016 2 commits
  6. 21 Jan, 2016 4 commits
    • Ilya Dryomov's avatar
      libceph: clear messenger auth_retry flag if we fault · f6330cc1
      Ilya Dryomov authored
      Commit 20e55c4c ("libceph: clear messenger auth_retry flag when we
      authenticate") got us only half way there.  We clear the flag if the
      second attempt succeeds, but it also needs to be cleared if that
      attempt fails, to allow for the exponential backoff to kick in.
      Otherwise, if ->should_authenticate() thinks our keys are valid, we
      will busy loop, incrementing auth_retry to no avail:
      
          process_connect ffff880079a63830 got BADAUTHORIZER attempt 1
          process_connect ffff880079a63830 got BADAUTHORIZER attempt 2
          process_connect ffff880079a63830 got BADAUTHORIZER attempt 3
          process_connect ffff880079a63830 got BADAUTHORIZER attempt 4
          process_connect ffff880079a63830 got BADAUTHORIZER attempt 5
          ...
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Reviewed-by: default avatarSage Weil <sage@redhat.com>
      f6330cc1
    • Ilya Dryomov's avatar
      libceph: fix ceph_msg_revoke() · 67645d76
      Ilya Dryomov authored
      There are a number of problems with revoking a "was sending" message:
      
      (1) We never make any attempt to revoke data - only kvecs contibute to
      con->out_skip.  However, once the header (envelope) is written to the
      socket, our peer learns data_len and sets itself to expect at least
      data_len bytes to follow front or front+middle.  If ceph_msg_revoke()
      is called while the messenger is sending message's data portion,
      anything we send after that call is counted by the OSD towards the now
      revoked message's data portion.  The effects vary, the most common one
      is the eventual hang - higher layers get stuck waiting for the reply to
      the message that was sent out after ceph_msg_revoke() returned and
      treated by the OSD as a bunch of data bytes.  This is what Matt ran
      into.
      
      (2) Flat out zeroing con->out_kvec_bytes worth of bytes to handle kvecs
      is wrong.  If ceph_msg_revoke() is called before the tag is sent out or
      while the messenger is sending the header, we will get a connection
      reset, either due to a bad tag (0 is not a valid tag) or a bad header
      CRC, which kind of defeats the purpose of revoke.  Currently the kernel
      client refuses to work with header CRCs disabled, but that will likely
      change in the future, making this even worse.
      
      (3) con->out_skip is not reset on connection reset, leading to one or
      more spurious connection resets if we happen to get a real one between
      con->out_skip is set in ceph_msg_revoke() and before it's cleared in
      write_partial_skip().
      
      Fixing (1) and (3) is trivial.  The idea behind fixing (2) is to never
      zero the tag or the header, i.e. send out tag+header regardless of when
      ceph_msg_revoke() is called.  That way the header is always correct, no
      unnecessary resets are induced and revoke stands ready for disabled
      CRCs.  Since ceph_msg_revoke() rips out con->out_msg, introduce a new
      "message out temp" and copy the header into it before sending.
      
      Cc: stable@vger.kernel.org # 4.0+
      Reported-by: default avatarMatt Conner <matt.conner@keepertech.com>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Tested-by: default avatarMatt Conner <matt.conner@keepertech.com>
      Reviewed-by: default avatarSage Weil <sage@redhat.com>
      67645d76
    • Geliang Tang's avatar
      libceph: use list_for_each_entry_safe · 10bcee14
      Geliang Tang authored
      Use list_for_each_entry_safe() instead of list_for_each_safe() to
      simplify the code.
      Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
      [idryomov@gmail.com: nuke call to list_splice_init() as well]
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      10bcee14
    • Geliang Tang's avatar
      libceph: use list_next_entry instead of list_entry_next · 17ddc49b
      Geliang Tang authored
      list_next_entry has been defined in list.h, so I replace list_entry_next
      with it.
      Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      17ddc49b
  7. 02 Nov, 2015 5 commits
    • Ilya Dryomov's avatar
      libceph: clear msg->con in ceph_msg_release() only · 583d0fef
      Ilya Dryomov authored
      The following bit in ceph_msg_revoke_incoming() is unsafe:
      
          struct ceph_connection *con = msg->con;
          if (!con)
                  return;
          mutex_lock(&con->mutex);
          <more msg->con use>
      
      There is nothing preventing con from getting destroyed right after
      msg->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():
      
                           <yet another reply w/o a signature>
                                         ...
                <Ctrl-C>
          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
                                                  <clear con->in_msg->con>
                                                  <put con ref>
                                                    put_osd
                                                      <free osd/con>
                    <msg->con use> <-- !!!
      
      If ceph_msg_revoke_incoming() executes "before" the reset handler,
      osd/con will be leaked because ceph_msg_revoke_incoming() clears
      con->in_msg but doesn't put con ref, while reset_connection() only puts
      con ref if con->in_msg != NULL.
      
      The current msg->con scheme was introduced by commits 38941f80
      ("libceph: have messages point to their connection") and 92ce034b
      ("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->con and ceph_msg_release() to clear
      it.
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      583d0fef
    • Ilya Dryomov's avatar
      libceph: add nocephx_sign_messages option · a51983e4
      Ilya Dryomov authored
      Support for message signing was merged into 3.19, along with
      nocephx_require_signatures option.  But, all that option does is allow
      the kernel client to talk to clusters that don't support MSG_AUTH
      feature bit.  That's pretty useless, given that it's been supported
      since bobtail.
      
      Meanwhile, if one disables message signing on the server side with
      "cephx sign messages = false", it becomes impossible to use the kernel
      client since it expects messages to be signed if MSG_AUTH was
      negotiated.  Add nocephx_sign_messages option to support this use case.
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      a51983e4
    • Ilya Dryomov's avatar
      libceph: stop duplicating client fields in messenger · 859bff51
      Ilya Dryomov authored
      supported_features and required_features serve no purpose at all, while
      nocrc and tcp_nodelay belong to ceph_options::flags.
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      859bff51
    • Ilya Dryomov's avatar
      libceph: msg signing callouts don't need con argument · 79dbd1ba
      Ilya Dryomov authored
      We can use msg->con instead - at the point we sign an outgoing message
      or check the signature on the incoming one, msg->con is always set.  We
      wouldn't know how to sign a message without an associated session (i.e.
      msg->con == NULL) and being able to sign a message using an explicitly
      provided authorizer is of no use.
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      79dbd1ba
    • Shraddha Barke's avatar
      libceph: use local variable cursor instead of &msg->cursor · 343128ce
      Shraddha Barke authored
      Use local variable cursor in place of &msg->cursor in
      read_partial_msg_data() and write_partial_msg_data().
      Signed-off-by: default avatarShraddha Barke <shraddha.6596@gmail.com>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      343128ce
  8. 17 Sep, 2015 1 commit
  9. 09 Sep, 2015 1 commit
    • Ilya Dryomov's avatar
      libceph: check data_len in ->alloc_msg() · d15f9d69
      Ilya Dryomov authored
      Only ->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 ->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.  ->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, ->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 ->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: default avatarIlya Dryomov <idryomov@gmail.com>
      Reviewed-by: default avatarAlex Elder <elder@linaro.org>
      d15f9d69
  10. 08 Sep, 2015 3 commits
  11. 09 Jul, 2015 2 commits
    • Ilya Dryomov's avatar
      libceph: treat sockaddr_storage with uninitialized family as blank · c44bd69c
      Ilya Dryomov authored
      addr_is_blank() should return true if family is neither AF_INET nor
      AF_INET6.  This is what its counterpart entity_addr_t::is_blank_ip() is
      doing and it is the right thing to do: in process_banner() we check if
      our address is blank and if it is "learn" it from our peer.  As it is,
      we never learn our address and always send out a blank one.  This goes
      way back to ceph.git commit dd732cbfc1c9 ("use sockaddr_storage; and
      some ipv6 support groundwork") from 2009.
      
      While at at, do not open-code ipv6_addr_any() and use INADDR_ANY
      constant instead of 0.
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Reviewed-by: default avatarSage Weil <sage@redhat.com>
      c44bd69c
    • Ilya Dryomov's avatar
      libceph: enable ceph in a non-default network namespace · 757856d2
      Ilya Dryomov authored
      Grab a reference on a network namespace of the 'rbd map' (in case of
      rbd) or 'mount' (in case of ceph) process and use that to open sockets
      instead of always using init_net and bailing if network namespace is
      anything but init_net.  Be careful to not share struct ceph_client
      instances between different namespaces and don't add any code in the
      !CONFIG_NET_NS case.
      
      This is based on a patch from Hong Zhiguo <zhiguohong@tencent.com>.
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Reviewed-by: default avatarSage Weil <sage@redhat.com>
      757856d2
  12. 29 Jun, 2015 1 commit
  13. 25 Jun, 2015 1 commit
  14. 11 May, 2015 1 commit
  15. 20 Apr, 2015 1 commit
    • Ilya Dryomov's avatar
      libceph: don't overwrite specific con error msgs · 67c64eb7
      Ilya Dryomov authored
      - specific con->error_msg messages (e.g. "protocol version mismatch")
        end up getting overwritten by a catch-all "socket error on read
        / write", introduced in commit 3a140a0d ("libceph: report socket
        read/write error message")
      - "bad message sequence # for incoming message" loses to "bad crc" due
        to the fact that -EBADMSG is used for both
      
      Fix it, and tidy up con->error_msg assignments and pr_errs while at it.
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      67c64eb7
  16. 07 Apr, 2015 1 commit
    • Ilya Dryomov's avatar
      Revert "libceph: use memalloc flags for net IO" · 6d7fdb0a
      Ilya Dryomov authored
      This reverts commit 89baaa57.
      
      Dirty page throttling should be sufficient for us in the general case
      so there is no need to use __GFP_MEMALLOC - it would be needed only in
      the swap-over-rbd case, which we currently don't support.  (It would
      probably take approximately the commit that is being reverted to add
      that support, but we would also need the "swap" option to distinguish
      from the general case and make sure swap ceph_client-s aren't shared
      with anything else.)  See ceph-devel threads [1] and [2] for the
      details of why enabling pfmemalloc reserves for all cases is a bad
      thing.
      
      On top of potential system lockups related to drained emergency
      reserves, this turned out to cause ceph lockups in case peers are on
      the same host and communicating via loopback due to sk_filter()
      dropping pfmemalloc skbs on the receiving side because the receiving
      loopback socket is not tagged with SOCK_MEMALLOC.
      
      [1] "SOCK_MEMALLOC vs loopback"
          http://www.spinics.net/lists/ceph-devel/msg22998.html
      [2] "[PATCH] libceph: don't set memalloc flags in loopback case"
          http://www.spinics.net/lists/ceph-devel/msg23392.html
      
      Conflicts:
      	net/ceph/messenger.c [ context: tcp_nodelay option ]
      
      Cc: Mike Christie <michaelc@cs.wisc.edu>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Sage Weil <sage@redhat.com>
      Cc: stable@vger.kernel.org # 3.18+, needs backporting
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Acked-by: default avatarMike Christie <michaelc@cs.wisc.edu>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      6d7fdb0a
  17. 19 Feb, 2015 1 commit
  18. 17 Dec, 2014 2 commits
  19. 30 Oct, 2014 1 commit
    • Mike Christie's avatar
      libceph: use memalloc flags for net IO · 89baaa57
      Mike Christie authored
      This patch has ceph's lib code use the memalloc flags.
      
      If the VM layer needs to write data out to free up memory to handle new
      allocation requests, the block layer must be able to make forward progress.
      To handle that requirement we use structs like mempools to reserve memory for
      objects like bios and requests.
      
      The problem is when we send/receive block layer requests over the network
      layer, net skb allocations can fail and the system can lock up.
      To solve this, the memalloc related flags were added. NBD, iSCSI
      and NFS uses these flags to tell the network/vm layer that it should
      use memory reserves to fullfill allcation requests for structs like
      skbs.
      
      I am running ceph in a bunch of VMs in my laptop, so this patch was
      not tested very harshly.
      Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
      Reviewed-by: default avatarIlya Dryomov <idryomov@redhat.com>
      89baaa57
  20. 14 Oct, 2014 3 commits
  21. 09 Aug, 2014 1 commit
    • Ilya Dryomov's avatar
      libceph: set last_piece in ceph_msg_data_pages_cursor_init() correctly · 5f740d7e
      Ilya Dryomov authored
      Determining ->last_piece based on the value of ->page_offset + length
      is incorrect because length here is the length of the entire message.
      ->last_piece set to false even if page array data item length is <=
      PAGE_SIZE, which results in invalid length passed to
      ceph_tcp_{send,recv}page() and causes various asserts to fire.
      
          # cat pages-cursor-init.sh
          #!/bin/bash
          rbd create --size 10 --image-format 2 foo
          FOO_DEV=$(rbd map foo)
          dd if=/dev/urandom of=$FOO_DEV bs=1M &>/dev/null
          rbd snap create foo@snap
          rbd snap protect foo@snap
          rbd clone foo@snap bar
          # rbd_resize calls librbd rbd_resize(), size is in bytes
          ./rbd_resize bar $(((4 << 20) + 512))
          rbd resize --size 10 bar
          BAR_DEV=$(rbd map bar)
          # trigger a 512-byte copyup -- 512-byte page array data item
          dd if=/dev/urandom of=$BAR_DEV bs=1M count=1 seek=5
      
      The problem exists only in ceph_msg_data_pages_cursor_init(),
      ceph_msg_data_pages_advance() does the right thing.  The size_t cast is
      unnecessary.
      
      Cc: stable@vger.kernel.org # 3.10+
      Signed-off-by: default avatarIlya Dryomov <ilya.dryomov@inktank.com>
      Reviewed-by: default avatarSage Weil <sage@redhat.com>
      Reviewed-by: default avatarAlex Elder <elder@linaro.org>
      5f740d7e
  22. 08 Jul, 2014 1 commit