02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

02 Oct, 2017

1 commit

  • commit 3ae0bebc "ceph: queue cap snap only when snap realm's
    context changes" introduced a regression: we may not call
    queue_realm_cap_snaps() for newly created snap realm. This
    regression allows unflushed snapshot data to be overwritten.

    Link: http://tracker.ceph.com/issues/21483
    Signed-off-by: "Yan, Zheng"
    Signed-off-by: Ilya Dryomov

    Yan, Zheng
     

07 Sep, 2017

1 commit


04 May, 2017

1 commit

  • refcount_t type and corresponding API should be
    used instead of atomic_t when the variable is used as
    a reference counter. This allows to avoid accidental
    refcounter overflows that might lead to use-after-free
    situations.

    Signed-off-by: Elena Reshetova
    Signed-off-by: Hans Liljestrand
    Signed-off-by: Kees Cook
    Signed-off-by: David Windsor
    Signed-off-by: Ilya Dryomov

    Elena Reshetova
     

13 Dec, 2016

1 commit


28 Jul, 2016

4 commits


26 Mar, 2016

1 commit

  • ceph_empty_snapc->num_snaps == 0 at all times. Passing such a snapc to
    ceph_osdc_alloc_request() (possibly through ceph_osdc_new_request()) is
    equivalent to passing NULL, as ceph_osdc_alloc_request() uses it only
    for sizing the request message.

    Further, in all four cases the subsequent ceph_osdc_build_request() is
    passed NULL for snapc, meaning that 0 is encoded for seq and num_snaps
    and making ceph_empty_snapc entirely useless. The two cases where it
    actually mattered were removed in commits 860560904962 ("ceph: avoid
    sending unnessesary FLUSHSNAP message") and 23078637e054 ("ceph: fix
    queuing inode to mdsdir's snaprealm").

    Signed-off-by: Ilya Dryomov
    Reviewed-by: Yan, Zheng

    Ilya Dryomov
     

09 Sep, 2015

1 commit

  • During MDS failovers, MClientSnap message may cause kclient to move
    some inodes from root directory's snaprealm to mdsdir's snaprealm
    and queue snapshots for these inodes. For a FS has never created any
    snapshot, both root directory's snaprealm and mdsdir's snaprealm
    share the same snapshot contexts (both are ceph_empty_snapc). This
    confuses ceph_put_wrbuffer_cap_refs(), make it unable to distinguish
    snapshot buffers from head buffers.

    The fix is do not use ceph_empty_snapc as snaprealm's cached context.

    Signed-off-by: Yan, Zheng

    Yan, Zheng
     

25 Jun, 2015

4 commits

  • Signed-off-by: Yan, Zheng

    Yan, Zheng
     
  • when a snap notification contains no new snapshot, we can avoid
    sending FLUSHSNAP message to MDS. But we still need to create
    cap_snap in some case because it's required by write path and
    page writeback path

    Signed-off-by: Yan, Zheng

    Yan, Zheng
     
  • In most cases that snap context is needed, we are holding
    reference of CEPH_CAP_FILE_WR. So we can set ceph inode's
    i_head_snapc when getting the CEPH_CAP_FILE_WR reference,
    and make codes get snap context from i_head_snapc. This makes
    the code simpler.

    Another benefit of this change is that we can handle snap
    notification more elegantly. Especially when snap context
    is updated while someone else is doing write. The old queue
    cap_snap code may set cap_snap's context to ether the old
    context or the new snap context, depending on if i_head_snapc
    is set. The new queue capp_snap code always set cap_snap's
    context to the old snap context.

    Signed-off-by: Yan, Zheng

    Yan, Zheng
     
  • Cached_context in ceph_snap_realm is directly accessed by
    uninline_data() and get_pool_perm(). This is racy in theory.
    both uninline_data() and get_pool_perm() do not modify existing
    object, they only create new object. So we can pass the empty
    snap context to them. Unlike cached_context in ceph_snap_realm,
    we do not need to protect the empty snap context.

    Signed-off-by: Yan, Zheng

    Yan, Zheng
     

19 Feb, 2015

1 commit

  • When snaprealm is created, its initial reference count is zero.
    But in some rare cases, the newly created snaprealm is not referenced
    by anyone. This causes snaprealm with zero reference count not freed.

    The fix is set reference count of newly snaprealm to 1. The reference
    is return the function who requests to create the snaprealm. When the
    function finishes its job, it releases the reference.

    Signed-off-by: Yan, Zheng

    Yan, Zheng
     

18 Dec, 2014

3 commits

  • After converting inline data to normal data, client need to flush
    the new i_inline_version (CEPH_INLINE_NONE) to MDS. This commit makes
    cap messages (sent to MDS) contain inline_version and inline_data.
    Client always converts inline data to normal data before data write,
    so the inline data length part is always zero.

    Signed-off-by: Yan, Zheng

    Yan, Zheng
     
  • Current snaphost code does not properly handle moving inode from one
    empty snap realm to another empty snap realm. After changing inode's
    snap realm, some dirty pages' snap context can be not equal to inode's
    i_head_snap. This can trigger BUG() in ceph_put_wrbuffer_cap_refs()

    The fix is introduce a global empty snap context for all empty snap
    realm. This avoids triggering the BUG() for filesystem with no snapshot.

    Fixes: http://tracker.ceph.com/issues/9928

    Signed-off-by: Yan, Zheng
    Reviewed-by: Ilya Dryomov

    Yan, Zheng
     
  • The functions ceph_put_snap_context() and iput() test whether their
    argument is NULL and then return immediately. Thus the test around the
    call is not needed.

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring
    [idryomov@redhat.com: squashed rbd.c hunk, changelog]
    Signed-off-by: Ilya Dryomov

    SF Markus Elfring
     

02 May, 2013

1 commit


31 Jul, 2012

1 commit

  • There are two structures in which a count of snapshots are
    maintained:

    struct ceph_snap_context {
    ...
    u32 num_snaps;
    ...
    }
    and
    struct ceph_snap_realm {
    ...
    u32 num_prior_parent_snaps; /* had prior to parent_since */
    ...
    u32 num_snaps;
    ...
    }

    These fields never take on negative values (e.g., to hold special
    meaning), and so are really inherently unsigned. Furthermore they
    take their value from over-the-wire or on-disk formatted 32-bit
    values.

    So change their definition to have type u32, and change some spots
    elsewhere in the code to account for this change.

    Signed-off-by: Alex Elder
    Reviewed-by: Josh Durgin

    Alex Elder
     

01 Jun, 2012

1 commit

  • ULONG_MAX is often used to check for integer overflow when calculating
    allocation size. While ULONG_MAX happens to work on most systems, there
    is no guarantee that `size_t' must be the same size as `long'.

    This patch introduces SIZE_MAX, the maximum value of `size_t', to improve
    portability and readability for allocation size validation.

    Signed-off-by: Xi Wang
    Acked-by: Alex Elder
    Cc: David Airlie
    Cc: Pekka Enberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Xi Wang
     

22 Mar, 2012

1 commit


08 Dec, 2011

1 commit

  • 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: Amon Ott
    Signed-off-by: Sage Weil

    Sage Weil
     

27 Jul, 2011

2 commits

  • We used to go into this branch if i_wrbuffer_ref_head was non-zero. This
    was an ancient check from before we were careful about dealing with all
    kinds of caps (and not just dirty pages). It is cleaner to only queue a
    capsnap if there is an actual dirty cap. If we are racing with...
    something...we will end up here with ci->i_wrbuffer_refs but no dirty
    caps.

    Reviewed-by: Yehuda Sadeh
    Signed-off-by: Sage Weil

    Sage Weil
     
  • There are two problems that come up when we try to queue a capsnap while a
    write is in progress:

    - The FILE_WR cap is held, but not yet dirty, so we may queue a capsnap
    with dirty == 0. That will crash later in __ceph_flush_snaps(). Or
    on the FILE_WR cap if a write is in progress.
    - We may not have i_head_snapc set, which causes problems pretty quickly.
    Look to the snaprealm in this case.

    Reviewed-by: Yehuda Sadeh
    Signed-off-by: Sage Weil

    Sage Weil
     

08 Jun, 2011

1 commit


12 May, 2011

1 commit


31 Mar, 2011

1 commit


29 Mar, 2011

1 commit

  • Fix the incorrect use of igrab() inside the i_lock in NFS and Ceph‥

    If we are already holding the i_lock, we have a reference to the
    inode so we can safely use ihold() to gain an extra reference. This
    avoids hangs due to lock recursion on the i_lock now that the
    inode_lock is gone and igrab() uses the i_lock itself.

    Signed-off-by: Dave Chinner
    Cc: Al Viro
    Cc: linux-fsdevel@vger.kernel.org
    Cc: Ryan Mallon
    Signed-off-by: Linus Torvalds

    Dave Chinner
     

05 Feb, 2011

1 commit

  • We were forming a dirty list, and then queueing cap_snaps for each realm
    _and_ its children, regardless of whether the children were already in the
    dirty list. This meant we did it twice for some realms. Which in turn
    meant we corrupted mdsc->snap_flush_list when the cap_snap was re-added to
    the list it was already on, and could trigger an infinite loop.

    We were also using recursion to do reach all the children, a no-no when
    stack is limited.

    Instead, (re)queue any children on the dirty list, avoiding processing
    anything twice and avoiding any recursion.

    Signed-off-by: Sage Weil

    Sage Weil
     

21 Oct, 2010

1 commit

  • This factors out protocol and low-level storage parts of ceph into a
    separate libceph module living in net/ceph and include/linux/ceph. This
    is mostly a matter of moving files around. However, a few key pieces
    of the interface change as well:

    - ceph_client becomes ceph_fs_client and ceph_client, where the latter
    captures the mon and osd clients, and the fs_client gets the mds client
    and file system specific pieces.
    - Mount option parsing and debugfs setup is correspondingly broken into
    two pieces.
    - The mon client gets a generic handler callback for otherwise unknown
    messages (mds map, in this case).
    - The basic supported/required feature bits can be expanded (and are by
    ceph_fs_client).

    No functional change, aside from some subtle error handling cases that got
    cleaned up in the refactoring process.

    Signed-off-by: Sage Weil

    Yehuda Sadeh
     

17 Sep, 2010

2 commits

  • Sending multiple flushsnap messages is problematic because we ignore
    the response if the tid doesn't match, and the server may only respond to
    each one once. It's also a waste.

    So, skip cap_snaps that are already on the flushing list, unless the caller
    tells us to resend (because we are reconnecting).

    Signed-off-by: Sage Weil

    Sage Weil
     
  • The cap_snap creation/queueing relies on both the current i_head_snapc
    _and_ the i_snap_realm pointers being correct, so that the new cap_snap
    can properly reference the old context and the new i_head_snapc can be
    updated to reference the new snaprealm's context. To fix this, we:

    - move inodes completely to the new (split) realm so that i_snap_realm
    is correct, and
    - generate the new snapc's _before_ queueing the cap_snaps in
    ceph_update_snap_trace().

    Signed-off-by: Sage Weil

    Sage Weil
     

15 Sep, 2010

1 commit


25 Aug, 2010

1 commit

  • We used to use i_head_snapc to keep track of which snapc the current epoch
    of dirty data was dirtied under. It is used by queue_cap_snap to set up
    the cap_snap. However, since we queue cap snaps for any dirty caps, not
    just for dirty file data, we need to keep a valid i_head_snapc anytime
    we have dirty|flushing caps. This fixes a NULL pointer deref in
    queue_cap_snap when writing back dirty caps without data (e.g.,
    snaptest-authwb.sh).

    Signed-off-by: Sage Weil

    Sage Weil
     

23 Aug, 2010

2 commits

  • When a realm is updated, we need to queue writeback on inodes in that
    realm _and_ its children. Otherwise, if the inode gets cowed on the
    server, we can get a hang later due to out-of-sync cap/snap state.

    Signed-off-by: Sage Weil

    Sage Weil
     
  • When we snapshot dirty metadata that needs to be written back to the MDS,
    include dirty xattr metadata. Make the capsnap reference the encoded
    xattr blob so that it will be written back in the FLUSHSNAP op.

    Also fix the capsnap creation guard to include dirty auth or file bits,
    not just tests specific to dirty file data or file writes in progress
    (this fixes auth metadata writeback).

    Signed-off-by: Sage Weil

    Sage Weil
     

18 May, 2010

1 commit

  • ceph_sb_to_client and ceph_client are really identical, we need to dump
    one; while function ceph_client is confusing with "struct ceph_client",
    ceph_sb_to_client's definition is more clear; so we'd better switch all
    call to ceph_sb_to_client.

    -static inline struct ceph_client *ceph_client(struct super_block *sb)
    -{
    - return sb->s_fs_info;
    -}

    Signed-off-by: Cheng Renquan
    Signed-off-by: Sage Weil

    Cheng Renquan
     

04 May, 2010

1 commit

  • The snap realm split was checking i_snap_realm, not the list_head, to
    determine if an inode belonged in the new realm. The check always failed,
    which meant we always moved the inode, corrupting the old realm's list and
    causing various crashes.

    Also wait to release old realm reference to avoid possibility of use after
    free.

    Signed-off-by: Sage Weil

    Sage Weil