1. 02 5月, 2013 8 次提交
    • A
      libceph: separate read and write data · 0fff87ec
      Alex Elder 提交于
      An osd request defines information about where data to be read
      should be placed as well as where data to write comes from.
      Currently these are represented by common fields.
      
      Keep information about data for writing separate from data to be
      read by splitting these into data_in and data_out fields.
      
      This is the key patch in this whole series, in that it actually
      identifies which osd requests generate outgoing data and which
      generate incoming data.  It's less obvious (currently) that an osd
      CALL op generates both outgoing and incoming data; that's the focus
      of some upcoming work.
      
      This resolves:
          http://tracker.ceph.com/issues/4127Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      0fff87ec
    • A
      libceph: distinguish page and bio requests · 2ac2b7a6
      Alex Elder 提交于
      An osd request uses either pages or a bio list for its data.  Use a
      union to record information about the two, and add a data type
      tag to select between them.
      Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      2ac2b7a6
    • A
      libceph: separate osd request data info · 2794a82a
      Alex Elder 提交于
      Pull the fields in an osd request structure that define the data for
      the request out into a separate structure.
      Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      2794a82a
    • A
      libceph: don't assign page info in ceph_osdc_new_request() · 153e5167
      Alex Elder 提交于
      Currently ceph_osdc_new_request() assigns an osd request's
      r_num_pages and r_alignment fields.  The only thing it does
      after that is call ceph_osdc_build_request(), and that doesn't
      need those fields to be assigned.
      
      Move the assignment of those fields out of ceph_osdc_new_request()
      and into its caller.  As a result, the page_align parameter is no
      longer used, so get rid of it.
      
      Note that in ceph_sync_write(), the value for req->r_num_pages had
      already been calculated earlier (as num_pages, and fortunately
      it was computed the same way).  So don't bother recomputing it,
      but because it's not needed earlier, move that calculation after the
      call to ceph_osdc_new_request().  Hold off making the assignment to
      r_alignment, doing it instead r_pages and r_num_pages are
      getting set.
      
      Similarly, in start_read(), nr_pages already holds the number of
      pages in the array (and is calculated the same way), so there's no
      need to recompute it.  Move the assignment of the page alignment
      down with the others there as well.
      
      This and the next few patches are preparation work for:
          http://tracker.ceph.com/issues/4127Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      153e5167
    • A
      ceph: simplify ceph_sync_write() page_align calculation · 3a42b6c4
      Alex Elder 提交于
      (This is being reposted.  The first one had a problem because it
      erroneously added a similar change elsewhere; that change has been
      dropped.)
      
      The next patch in this series points out that the calculation for
      the number of pages in an osd request is getting done twice.  It
      is not obvious, but the result of both calculations is identical.
      This patch simplifies one of them--as a separate step--to make
      it clear that the transformation in the next patch is valid.
      
      In ceph_sync_write() there is some magic that computes page_align
      for an osd request.  But a little analysis shows it can be
      simplified.
      
      First, we have:
       	io_align = pos & ~PAGE_MASK;
      which is used here:
      	page_align = (pos - io_align + buf_align) & ~PAGE_MASK;
      
      Note (pos - io_align) simply rounds "pos" down to the nearest multiple
      of the page size.
      
      We also have:
       	buf_align = (unsigned long)data & ~PAGE_MASK;
      
      Adding buf_align to that rounded-down "pos" value will stay within
      the same page; the result will just be offset by the page offset for
      the "data" pointer.  The final mask therefore leaves just the value
      of "buf_align".
      
      One more simplification.  Note that the result of calc_pages_for()
      is invariant of which page the offset starts in--the only thing that
      matters is the offset within the starting page.  We will have
      put the proper page offset to use into "page_align", so just use
      that in calculating num_pages.
      
      This resolves:
          http://tracker.ceph.com/issues/4166Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      3a42b6c4
    • Y
      ceph: acquire i_mutex in __ceph_do_pending_vmtruncate · 3f99969f
      Yan, Zheng 提交于
      make __ceph_do_pending_vmtruncate() acquire the i_mutex if the caller
      does not hold the i_mutex, so ceph_aio_read() can call safely.
      Signed-off-by: NYan, Zheng <zheng.z.yan@intel.com>
      Reviewed-by: NGreg Farnum <greg@inktank.com>
      3f99969f
    • Y
      ceph: don't early drop Fw cap · 6070e0c1
      Yan, Zheng 提交于
      ceph_aio_write() has an optimization that marks CEPH_CAP_FILE_WR
      cap dirty before data is copied to page cache and inode size is
      updated. The optimization avoids slow cap revocation caused by
      balance_dirty_pages(), but introduces inode size update race. If
      ceph_check_caps() flushes the dirty cap before the inode size is
      updated, MDS can miss the new inode size. So just remove the
      optimization.
      Signed-off-by: NYan, Zheng <zheng.z.yan@intel.com>
      Reviewed-by: NGreg Farnum <greg@inktank.com>
      6070e0c1
    • S
      ceph: revert commit 22cddde1 · 7971bd92
      Sage Weil 提交于
      commit 22cddde1 breaks the atomicity of write operation, it also
      introduces a deadlock between write and truncate.
      Signed-off-by: NYan, Zheng <zheng.z.yan@intel.com>
      Reviewed-by: NGreg Farnum <greg@inktank.com>
      
      Conflicts:
      	fs/ceph/addr.c
      7971bd92
  2. 23 2月, 2013 1 次提交
  3. 19 2月, 2013 1 次提交
  4. 18 1月, 2013 2 次提交
    • S
      ceph: Check for created flag in response from mds · 6e8575fa
      Sam Lang 提交于
      The mds now sends back a created inode if the create request
      performed the create.  If the file already existed, no inode is
      returned in the reply.  This allows ceph to set the created flag
      in atomic_open so that permissions are properly checked in the case
      that the file wasn't created by the create call to the mds.
      
      To ensure compability with previous kernels, a feature for sending
      back the inode in the create reply was added, so that the mds will
      only send back the inode if the client indicates it supports the
      feature.
      Signed-off-by: NSam Lang <sam.lang@inktank.com>
      Reviewed-by: NSage Weil <sage@inktank.com>
      6e8575fa
    • S
      ceph: Check for err on mds request in atomic_open · 79aec984
      Sam Lang 提交于
      The error returned by ceph_mdsc_do_request includes errors sending the
      request, errors on timeout, or any errors coming from the mds.  If
      ceph_mdsc_do_request returns an error, the reply struct will most likely
      be bogus.  We need to bail out and propogate the error instead of
      overwriting it.
      Signed-off-by: NSam Lang <sam.lang@inktank.com>
      Reviewed-by: NSage Weil <sage@inktank.com>
      79aec984
  5. 18 12月, 2012 1 次提交
  6. 06 11月, 2012 1 次提交
    • S
      ceph: Fix i_size update race · 22cddde1
      Sage Weil 提交于
      ceph_aio_write() has an optimization that marks cap EPH_CAP_FILE_WR
      dirty before data is copied to page cache and inode size is updated.
      If ceph_check_caps() flushes the dirty cap before the inode size is
      updated, MDS can miss the new inode size. The fix is move
      ceph_{get,put}_cap_refs() into ceph_write_{begin,end}() and call
      __ceph_mark_dirty_caps() after inode size is updated.
      Signed-off-by: NYan, Zheng <zheng.z.yan@intel.com>
      Signed-off-by: NSage Weil <sage@inktank.com>
      22cddde1
  7. 02 10月, 2012 1 次提交
  8. 03 8月, 2012 1 次提交
    • S
      ceph: simplify+fix atomic_open · 5ef50c3b
      Sage Weil 提交于
      The initial ->atomic_open op was carried over from the old intent code,
      which was incomplete and didn't really work.  Replace it with a fresh
      method.  In particular:
      
       * always attempt to do an atomic open+lookup, both for the create case
         and for lookups of existing files.
       * fix symlink handling by returning 1 to the VFS so that we can follow
         the link to its destination. This fixes a longstanding ceph bug (#2392).
      Signed-off-by: NSage Weil <sage@inktank.com>
      5ef50c3b
  9. 14 7月, 2012 5 次提交
  10. 08 5月, 2012 1 次提交
  11. 14 12月, 2011 1 次提交
  12. 08 12月, 2011 1 次提交
    • S
      ceph: use i_ceph_lock instead of i_lock · be655596
      Sage Weil 提交于
      We have been using i_lock to protect all kinds of data structures in the
      ceph_inode_info struct, including lists of inodes that we need to iterate
      over while avoiding races with inode destruction.  That requires grabbing
      a reference to the inode with the list lock protected, but igrab() now
      takes i_lock to check the inode flags.
      
      Changing the list lock ordering would be a painful process.
      
      However, using a ceph-specific i_ceph_lock in the ceph inode instead of
      i_lock is a simple mechanical change and avoids the ordering constraints
      imposed by igrab().
      Reported-by: NAmon Ott <a.ott@m-privacy.de>
      Signed-off-by: NSage Weil <sage@newdream.net>
      be655596
  13. 27 7月, 2011 6 次提交
  14. 21 7月, 2011 1 次提交
  15. 20 7月, 2011 1 次提交
  16. 14 6月, 2011 2 次提交
  17. 08 6月, 2011 3 次提交
  18. 05 5月, 2011 1 次提交
  19. 22 3月, 2011 2 次提交
    • H
      ceph: add request to the tail of unsafe write list · 49bcb932
      Henry C Chang 提交于
      In sync_write_wait(), we assume that the newest request is at the
      tail of unsafe write list. We should maintain the semantics here.
      Signed-off-by: NHenry C Chang <henry_c_chang@tcloudcomputing.com>
      Signed-off-by: NSage Weil <sage@newdream.net>
      49bcb932
    • H
      ceph: remove request from unsafe list if it is canceled/timed out · 78a25565
      Henry C Chang 提交于
      This fixes the list corruption warning like this:
      
      ------------[ cut here ]------------
      WARNING: at lib/list_debug.c:30 __list_add+0x68/0x81()
      Hardware name: X8DTU
      list_add corruption. prev->next should be next (ffff880618931250), but was (null). (prev=ffff880c188b9130).
      Modules linked in: nfsd lockd nfs_acl auth_rpcgss exportfs ceph libceph libcrc32c sunrpc ipv6 fuse igb i2c_i801 ioatdma i2c_core iTCO_wdt iTCO_vendor_support joydev dca serio_raw usb_storage [last unloaded: scsi_wait_scan]
      Pid: 10977, comm: smbd Tainted: G        W  2.6.32.23-170.Elaster.xendom0.fc12.x86_64 #1
      Call Trace:
      [<ffffffff8105753c>] warn_slowpath_common+0x7c/0x94
      [<ffffffff810575ab>] warn_slowpath_fmt+0x41/0x43
      [<ffffffff812351a3>] __list_add+0x68/0x81
      [<ffffffffa014799d>] ceph_aio_write+0x614/0x8a2 [ceph]
      [<ffffffff8111d2a0>] do_sync_write+0xe8/0x125
      [<ffffffff81075a1f>] ? autoremove_wake_function+0x0/0x39
      [<ffffffff811f21ec>] ? selinux_file_permission+0x5c/0xb3
      [<ffffffff811e8521>] ? security_file_permission+0x16/0x18
      [<ffffffff8111d864>] vfs_write+0xae/0x10b
      [<ffffffff8111d91b>] sys_pwrite64+0x5a/0x76
      [<ffffffff81012d32>] system_call_fastpath+0x16/0x1b
      ---[ end trace 08573eb9f07ff6f4 ]---
      Signed-off-by: NHenry C Chang <henry_c_chang@tcloudcomputing.com>
      Signed-off-by: NSage Weil <sage@newdream.net>
      78a25565