11 Jun, 2016

4 commits

  • Pull btrfs fixes from Chris Mason:
    "Has some fixes and some new self tests for btrfs. The self tests are
    usually disabled in the .config file (unless you're doing btrfs dev
    work), and this bunch is meant to find problems with the 64K page size
    patches.

    Jeff has a patch to help people see if they are using the hardware
    assist crc32c module, which really helps us nail down problems when
    people ask why crcs are using so much CPU.

    Otherwise, it's small fixes"

    * 'for-linus-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
    Btrfs: self-tests: Fix extent buffer bitmap test fail on BE system
    Btrfs: self-tests: Fix test_bitmaps fail on 64k sectorsize
    Btrfs: self-tests: Use macros instead of constants and add missing newline
    Btrfs: self-tests: Support testing all possible sectorsizes and nodesizes
    Btrfs: self-tests: Execute page straddling test only when nodesize < PAGE_SIZE
    btrfs: advertise which crc32c implementation is being used at module load
    Btrfs: add validadtion checks for chunk loading
    Btrfs: add more validation checks for superblock
    Btrfs: clear uptodate flags of pages in sys_array eb
    Btrfs: self-tests: Support non-4k page size
    Btrfs: Fix integer overflow when calculating bytes_per_bitmap
    Btrfs: test_check_exists: Fix infinite loop when searching for free space entries
    Btrfs: end transaction if we abort when creating uuid root
    btrfs: Use __u64 in exported linux/btrfs.h.

    Linus Torvalds
     
  • Merge filesystem stacking fixes from Jann Horn.

    * emailed patches from Jann Horn :
    sched: panic on corrupted stack end
    ecryptfs: forbid opening files without mmap handler
    proc: prevent stacking filesystems on top

    Linus Torvalds
     
  • This prevents users from triggering a stack overflow through a recursive
    invocation of pagefault handling that involves mapping procfs files into
    virtual memory.

    Signed-off-by: Jann Horn
    Acked-by: Tyler Hicks
    Cc: stable@vger.kernel.org
    Signed-off-by: Linus Torvalds

    Jann Horn
     
  • This prevents stacking filesystems (ecryptfs and overlayfs) from using
    procfs as lower filesystem. There is too much magic going on inside
    procfs, and there is no good reason to stack stuff on top of procfs.

    (For example, procfs does access checks in VFS open handlers, and
    ecryptfs by design calls open handlers from a kernel thread that doesn't
    drop privileges or so.)

    Signed-off-by: Jann Horn
    Cc: stable@vger.kernel.org
    Signed-off-by: Linus Torvalds

    Jann Horn
     

09 Jun, 2016

2 commits


08 Jun, 2016

4 commits

  • Pull vfs fixes from Al Viro:
    "Fixes for crap of assorted ages: EOPENSTALE one is 4.2+, autofs one is
    4.6, d_walk - 3.2+.

    The atomic_open() and coredump ones are regressions from this window"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    coredump: fix dumping through pipes
    fix a regression in atomic_open()
    fix d_walk()/non-delayed __d_free() race
    autofs braino fix for do_last()
    fix EOPENSTALE bug in do_last()

    Linus Torvalds
     
  • The offset in the core file used to be tracked with ->written field of
    the coredump_params structure. The field was retired in favour of
    file->f_pos.

    However, ->f_pos is not maintained for pipes which leads to breakage.

    Restore explicit tracking of the offset in coredump_params. Introduce
    ->pos field for this purpose since ->written was already reused.

    Fixes: a00839395103 ("get rid of coredump_params->written").

    Reported-by: Zbigniew Jędrzejewski-Szmek
    Signed-off-by: Mateusz Guzik
    Reviewed-by: Omar Sandoval
    Signed-off-by: Al Viro

    Mateusz Guzik
     
  • open("/foo/no_such_file", O_RDONLY | O_CREAT) on should fail with
    EACCES when /foo is not writable; failing with ENOENT is obviously
    wrong. That got broken by a braino introduced when moving the
    creat_error logics from atomic_open() to lookup_open(). Easy to
    fix, fortunately.

    Spotted-by: "Yan, Zheng"
    Tested-by: "Yan, Zheng"
    Signed-off-by: Al Viro

    Al Viro
     
  • Ascend-to-parent logics in d_walk() depends on all encountered child
    dentries not getting freed without an RCU delay. Unfortunately, in
    quite a few cases it is not true, with hard-to-hit oopsable race as
    the result.

    Fortunately, the fix is simiple; right now the rule is "if it ever
    been hashed, freeing must be delayed" and changing it to "if it
    ever had a parent, freeing must be delayed" closes that hole and
    covers all cases the old rule used to cover. Moreover, pipes and
    sockets remain _not_ covered, so we do not introduce RCU delay in
    the cases which are the reason for having that delay conditional
    in the first place.

    Cc: stable@vger.kernel.org # v3.2+ (and watch out for __d_materialise_dentry())
    Signed-off-by: Al Viro

    Al Viro
     

07 Jun, 2016

2 commits

  • MNT_LOCKED implies on a child mount implies the child is locked to the
    parent. So while looping through the children the children should be
    tested (not their parent).

    Typically an unshare of a mount namespace locks all mounts together
    making both the parent and the slave as locked but there are a few
    corner cases where other things work.

    Cc: stable@vger.kernel.org
    Fixes: ceeb0e5d39fc ("vfs: Ignore unlocked mounts in fs_fully_visible")
    Reported-by: Seth Forshee
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     
  • Add this trivial missing error handling.

    Cc: stable@vger.kernel.org
    Fixes: 1b852bceb0d1 ("mnt: Refactor the logic for mounting sysfs and proc in a user namespace")
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     

06 Jun, 2016

10 commits

  • In __test_eb_bitmaps(), we write random data to a bitmap. Then copy
    the bitmap to another bitmap that resides inside an extent buffer.
    Later we verify the values of corresponding bits in the bitmap and the
    bitmap inside the extent buffer. However, extent_buffer_test_bit()
    reads in byte granularity while test_bit() reads in unsigned long
    granularity. Hence we end up comparing wrong bits on big-endian
    systems such as ppc64. This commit fixes the issue by reading the
    bitmap in byte granularity.

    Reviewed-by: Josef Bacik
    Reviewed-by: Chandan Rajendra
    Signed-off-by: Feifei Xu
    Signed-off-by: David Sterba

    Feifei Xu
     
  • With 64K sectorsize, 1G sized block group cannot span across bitmaps.
    To execute test_bitmaps() function, this commit allocates
    "BITS_PER_BITMAP * sectorsize + PAGE_SIZE" sized block group.

    Reviewed-by: Josef Bacik
    Reviewed-by: Chandan Rajendra
    Signed-off-by: Feifei Xu
    Signed-off-by: David Sterba

    Feifei Xu
     
  • This commit replaces numerical constants with appropriate
    preprocessor macros.

    Reviewed-by: Josef Bacik
    Signed-off-by: Chandan Rajendra
    Signed-off-by: Feifei Xu
    Signed-off-by: David Sterba

    Feifei Xu
     
  • To test all possible sectorsizes, this commit adds a sectorsize
    array. This commit executes the tests for all possible sectorsizes and
    nodesizes.

    Reviewed-by: Josef Bacik
    Signed-off-by: Chandan Rajendra
    Signed-off-by: Feifei Xu
    Signed-off-by: David Sterba

    Feifei Xu
     
  • On ppc64, PAGE_SIZE is 64k which is same as BTRFS_MAX_METADATA_BLOCKSIZE.
    In such a scenario, we will never be able to have an extent buffer
    containing more than one page. Hence in such cases this commit does not
    execute the page straddling tests.

    Reviewed-by: Josef Bacik
    Signed-off-by: Feifei Xu
    Signed-off-by: Chandan Rajendra
    Signed-off-by: David Sterba

    Feifei Xu
     
  • Since several architectures support hardware-accelerated crc32c
    calculation, it would be nice to confirm that btrfs is actually using it.

    We can see an elevated use count for the module, but it doesn't actually
    show who the users are. This patch simply prints the name of the driver
    after successfully initializing the shash.

    Signed-off-by: Jeff Mahoney
    [ added a helper and used in module load-time message ]
    Signed-off-by: David Sterba

    Jeff Mahoney
     
  • To prevent fuzzed filesystem images from panic the whole system,
    we need various validation checks to refuse to mount such an image
    if btrfs finds any invalid value during loading chunks, including
    both sys_array and regular chunks.

    Note that these checks may not be sufficient to cover all corner cases,
    feel free to add more checks.

    Reported-by: Vegard Nossum
    Reported-by: Quentin Casasnovas
    Reviewed-by: David Sterba
    Signed-off-by: Liu Bo
    Signed-off-by: David Sterba

    Liu Bo
     
  • This adds validation checks for super_total_bytes, super_bytes_used and
    super_stripesize, super_num_devices.

    Reported-by: Vegard Nossum
    Reported-by: Quentin Casasnovas
    Reviewed-by: David Sterba
    Signed-off-by: Liu Bo
    Signed-off-by: David Sterba

    Liu Bo
     
  • We set uptodate flag to pages in the temporary sys_array eb,
    but do not clear the flag after free eb. As the special
    btree inode may still hold a reference on those pages, the
    uptodate flag can remain alive in them.

    If btrfs_super_chunk_root has been intentionally changed to the
    offset of this sys_array eb, reading chunk_root will read content
    of sys_array and it will skip our beautiful checks in
    btree_readpage_end_io_hook() because of
    "pages of eb are uptodate => eb is uptodate"

    This adds the 'clear uptodate' part to force it to read from disk.

    Reviewed-by: Josef Bacik
    Signed-off-by: Liu Bo
    Signed-off-by: David Sterba

    Liu Bo
     
  • The /dev/ptmx device node is changed to lookup the directory entry "pts"
    in the same directory as the /dev/ptmx device node was opened in. If
    there is a "pts" entry and that entry is a devpts filesystem /dev/ptmx
    uses that filesystem. Otherwise the open of /dev/ptmx fails.

    The DEVPTS_MULTIPLE_INSTANCES configuration option is removed, so that
    userspace can now safely depend on each mount of devpts creating a new
    instance of the filesystem.

    Each mount of devpts is now a separate and equal filesystem.

    Reserved ttys are now available to all instances of devpts where the
    mounter is in the initial mount namespace.

    A new vfs helper path_pts is introduced that finds a directory entry
    named "pts" in the directory of the passed in path, and changes the
    passed in path to point to it. The helper path_pts uses a function
    path_parent_directory that was factored out of follow_dotdot.

    In the implementation of devpts:
    - devpts_mnt is killed as it is no longer meaningful if all mounts of
    devpts are equal.
    - pts_sb_from_inode is replaced by just inode->i_sb as all cached
    inodes in the tty layer are now from the devpts filesystem.
    - devpts_add_ref is rolled into the new function devpts_ptmx. And the
    unnecessary inode hold is removed.
    - devpts_del_ref is renamed devpts_release and reduced to just a
    deacrivate_super.
    - The newinstance mount option continues to be accepted but is now
    ignored.

    In devpts_fs.h definitions for when !CONFIG_UNIX98_PTYS are removed as
    they are never used.

    Documentation/filesystems/devices.txt is updated to describe the current
    situation.

    This has been verified to work properly on openwrt-15.05, centos5,
    centos6, centos7, debian-6.0.2, debian-7.9, debian-8.2, ubuntu-14.04.3,
    ubuntu-15.10, fedora23, magia-5, mint-17.3, opensuse-42.1,
    slackware-14.1, gentoo-20151225 (13.0?), archlinux-2015-12-01. With the
    caveat that on centos6 and on slackware-14.1 that there wind up being
    two instances of the devpts filesystem mounted on /dev/pts, the lower
    copy does not end up getting used.

    Signed-off-by: "Eric W. Biederman"
    Cc: Greg KH
    Cc: Peter Hurley
    Cc: Peter Anvin
    Cc: Andy Lutomirski
    Cc: Al Viro
    Cc: Serge Hallyn
    Cc: Willy Tarreau
    Cc: Aurelien Jarno
    Cc: One Thousand Gnomes
    Cc: Jann Horn
    Cc: Jiri Slaby
    Cc: Florian Weimer
    Cc: Konstantin Khlebnikov
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     

05 Jun, 2016

2 commits

  • It's an analogue of commit 7500c38a (fix the braino in "namei:
    massage lookup_slow() to be usable by lookup_one_len_unlocked()").
    The same problem (->lookup()-returned unhashed negative dentry
    just might be an autofs one with ->d_manage() that would wait
    until the daemon makes it positive) applies in do_last() - we
    need to do follow_managed() first.

    Fortunately, remaining callers of follow_managed() are OK - only
    autofs has that weirdness (negative dentry that does not mean
    an instant -ENOENT)) and autofs never has its negative dentries
    hashed, so we can't pick one from a dcache lookup.

    ->d_manage() is a bloody mess ;-/

    Cc: stable@vger.kernel.org # v4.6
    Spotted-by: Ian Kent
    Signed-off-by: Al Viro

    Al Viro
     
  • Pull btrfs fixes from Chris Mason:
    "The important part of this pull is Filipe's set of fixes for btrfs
    device replacement. Filipe fixed a few issues seen on the list and a
    number he found on his own"

    * 'for-linus-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
    Btrfs: deal with duplciates during extent_map insertion in btrfs_get_extent
    Btrfs: fix race between device replace and read repair
    Btrfs: fix race between device replace and discard
    Btrfs: fix race between device replace and chunk allocation
    Btrfs: fix race setting block group back to RW mode during device replace
    Btrfs: fix unprotected assignment of the left cursor for device replace
    Btrfs: fix race setting block group readonly during device replace
    Btrfs: fix race between device replace and block group removal
    Btrfs: fix race between readahead and device replace/removal

    Linus Torvalds
     

04 Jun, 2016

2 commits

  • EOPENSTALE occuring at the last component of a trailing symlink ends up
    with do_last() retrying its lookup. After the symlink body has been
    discarded. The thing is, all this retry_lookup logics in there is not
    needed at all - the upper layers will do the right thing if we simply
    return that -EOPENSTALE as we would with any other error. Trying to
    microoptimize in do_last() is a lot of headache for no good reason.

    Cc: stable@vger.kernel.org # v4.2+
    Tested-by: Oleg Drokin
    Reviewed-and-Tested-by: Jeff Layton
    Signed-off-by: Al Viro

    Al Viro
     
  • When dealing with inline extents, btrfs_get_extent will incorrectly try
    to insert a duplicate extent_map. The dup hits -EEXIST from
    add_extent_map, but then we try to merge with the existing one and end
    up trying to insert a zero length extent_map.

    This actually works most of the time, except when there are extent maps
    past the end of the inline extent. rocksdb will trigger this sometimes
    because it preallocates an extent and then truncates down.

    Josef made a script to trigger with xfs_io:

    #!/bin/bash

    xfs_io -f -c "pwrite 0 1000" inline
    xfs_io -c "falloc -k 4k 1M" inline
    xfs_io -c "pread 0 1000" -c "fadvise -d 0 1000" -c "pread 0 1000" inline
    xfs_io -c "fadvise -d 0 1000" inline
    cat inline

    You'll get EIOs trying to read inline after this because add_extent_map
    is returning EEXIST

    Signed-off-by: Chris Mason

    Chris Mason
     

03 Jun, 2016

3 commits

  • self-tests code assumes 4k as the sectorsize and nodesize. This commit
    fix hardcoded 4K. Enables the self-tests code to be executed on non-4k
    page sized systems (e.g. ppc64).

    Reviewed-by: Josef Bacik
    Signed-off-by: Feifei Xu
    Signed-off-by: Chandan Rajendra
    Signed-off-by: David Sterba

    Feifei Xu
     
  • On ppc64, bytes_per_bitmap will be (65536*8*65536). Hence append UL to
    fix integer overflow.

    Reviewed-by: Josef Bacik
    Reviewed-by: Chandan Rajendra
    Signed-off-by: Feifei Xu
    Signed-off-by: David Sterba

    Feifei Xu
     
  • On a ppc64 machine using 64K as the block size, assume that the RB
    tree at btrfs_free_space_ctl->free_space_offset contains following
    two entries:

    1. A bitmap entry having an offset value of 0 and having the bits
    corresponding to the address range [128M+512K, 128M+768K] set.
    2. An extent entry corresponding to the address range
    [128M-256K, 128M-128K]

    In such a scenario, test_check_exists() invoked for checking the
    existence of address range [128M+768K, 256M] can lead to an
    infinite loop as explained below:

    - Checking for the extent entry fails.
    - Checking for a bitmap entry results in the free space info in
    range [128M+512K, 128M+768K] beng returned.
    - rb_prev(info) returns NULL because the bitmap entry starting from
    offset 0 comes first in the RB tree.
    - current_node = bitmap node.
    - while (current_node)
    tmp = rb_next(bitmap_node);/*tmp is extent based free space entry*/
    Since extent based free space entry's last address is smaller
    than the address being searched for (i.e. 128M+768K) we
    incorrectly again obtain the extent node as the "next right node"
    of the RB tree and thus end up looping infinitely.

    This patch fixes the issue by checking the "tmp" variable which point
    to the most recently searched free space node.

    Reviewed-by: Josef Bacik
    Reviewed-by: Chandan Rajendra
    Signed-off-by: Feifei Xu
    Signed-off-by: David Sterba

    Feifei Xu
     

01 Jun, 2016

8 commits


31 May, 2016

3 commits

  • While we are finishing a device replace operation we can have a concurrent
    task trying to do a read repair operation, in which case it will call
    btrfs_map_block() to get a struct btrfs_bio which can have a stripe that
    points to the source device of the device replace operation. This allows
    for the read repair task to dereference the stripe's device pointer after
    the device replace operation has freed the source device, resulting in
    an invalid memory access. This is similar to the problem solved by my
    previous patch in the same series and named "Btrfs: fix race between
    device replace and discard".

    So fix this by surrounding the call to btrfs_map_block() and the code
    that uses the returned struct btrfs_bio with calls to
    btrfs_bio_counter_inc_blocked() and btrfs_bio_counter_dec(), giving the
    proper serialization with the finishing phase of the device replace
    operation.

    Signed-off-by: Filipe Manana
    Reviewed-by: Josef Bacik

    Filipe Manana
     
  • While we are finishing a device replace operation, we can make a discard
    operation (fs mounted with -o discard) do an invalid memory access like
    the one reported by the following trace:

    [ 3206.384654] general protection fault: 0000 [#1] PREEMPT SMP
    [ 3206.387520] Modules linked in: dm_mod btrfs crc32c_generic xor raid6_pq acpi_cpufreq tpm_tis psmouse tpm ppdev sg parport_pc evdev i2c_piix4 parport
    processor serio_raw i2c_core pcspkr button loop autofs4 ext4 crc16 jbd2 mbcache sr_mod cdrom ata_generic sd_mod virtio_scsi ata_piix libata virtio_pci
    virtio_ring scsi_mod e1000 virtio floppy [last unloaded: btrfs]
    [ 3206.388595] CPU: 14 PID: 29194 Comm: fsstress Not tainted 4.6.0-rc7-btrfs-next-29+ #1
    [ 3206.388595] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS by qemu-project.org 04/01/2014
    [ 3206.388595] task: ffff88017ace0100 ti: ffff880171b98000 task.ti: ffff880171b98000
    [ 3206.388595] RIP: 0010:[] [] blkdev_issue_discard+0x5c/0x2a7
    [ 3206.388595] RSP: 0018:ffff880171b9bb80 EFLAGS: 00010246
    [ 3206.388595] RAX: ffff880171b9bc28 RBX: 000000000090d000 RCX: 0000000000000000
    [ 3206.388595] RDX: ffffffff82fa1b48 RSI: ffffffff8179f46c RDI: ffffffff82fa1b48
    [ 3206.388595] RBP: ffff880171b9bcc0 R08: 0000000000000000 R09: 0000000000000001
    [ 3206.388595] R10: ffff880171b9bce0 R11: 000000000090f000 R12: ffff880171b9bbe8
    [ 3206.388595] R13: 0000000000000010 R14: 0000000000004868 R15: 6b6b6b6b6b6b6b6b
    [ 3206.388595] FS: 00007f6182e4e700(0000) GS:ffff88023fdc0000(0000) knlGS:0000000000000000
    [ 3206.388595] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 3206.388595] CR2: 00007f617c2bbb18 CR3: 000000017ad9c000 CR4: 00000000000006e0
    [ 3206.388595] Stack:
    [ 3206.388595] 0000000000004878 0000000000000000 0000000002400040 0000000000000000
    [ 3206.388595] 0000000000000000 ffff880171b9bbe8 ffff880171b9bbb0 ffff880171b9bbb0
    [ 3206.388595] ffff880171b9bbc0 ffff880171b9bbc0 ffff880171b9bbd0 ffff880171b9bbd0
    [ 3206.388595] Call Trace:
    [ 3206.388595] [] btrfs_issue_discard+0x12f/0x143 [btrfs]
    [ 3206.388595] [] ? btrfs_issue_discard+0x12f/0x143 [btrfs]
    [ 3206.388595] [] btrfs_discard_extent+0x87/0xde [btrfs]
    [ 3206.388595] [] btrfs_finish_extent_commit+0xb2/0x1df [btrfs]
    [ 3206.388595] [] ? __mutex_unlock_slowpath+0x150/0x15b
    [ 3206.388595] [] btrfs_commit_transaction+0x7fc/0x980 [btrfs]
    [ 3206.388595] [] ? __mutex_unlock_slowpath+0x150/0x15b
    [ 3206.388595] [] btrfs_sync_file+0x38f/0x428 [btrfs]
    [ 3206.388595] [] vfs_fsync_range+0x8c/0x9e
    [ 3206.388595] [] vfs_fsync+0x1c/0x1e
    [ 3206.388595] [] do_fsync+0x31/0x4a
    [ 3206.388595] [] SyS_fsync+0x10/0x14
    [ 3206.388595] [] entry_SYSCALL_64_fastpath+0x18/0xa8
    [ 3206.388595] [] ? time_hardirqs_off+0x9/0x14
    [ 3206.388595] [] ? trace_hardirqs_off_caller+0x1f/0xaa

    This happens because when we call btrfs_map_block() from
    btrfs_discard_extent() to get a btrfs_bio structure, the device replace
    operation has not finished yet, but before we use the device of one of the
    stripes from the returned btrfs_bio structure, the device object is freed.

    This is illustrated by the following diagram.

    CPU 1 CPU 2

    btrfs_dev_replace_start()

    (...)

    btrfs_dev_replace_finishing()

    btrfs_start_transaction()
    btrfs_commit_transaction()

    (...)

    btrfs_sync_file()
    btrfs_start_transaction()

    (...)

    btrfs_commit_transaction()
    btrfs_finish_extent_commit()
    btrfs_discard_extent()
    btrfs_map_block()
    --> returns a struct btrfs_bio
    with a stripe that has a
    device field pointing to
    source device of the replace
    operation (the device that
    is being replaced)

    mutex_lock(&uuid_mutex)
    mutex_lock(&fs_info->fs_devices->device_list_mutex)
    mutex_lock(&fs_info->chunk_mutex)

    btrfs_dev_replace_update_device_in_mapping_tree()
    --> iterates the mapping tree and for each
    extent map that has a stripe pointing to
    the source device, it updates the stripe
    to point to the target device instead

    btrfs_rm_dev_replace_blocked()
    --> waits for fs_info->bio_counter to go down to 0

    btrfs_rm_dev_replace_remove_srcdev()
    --> removes source device from the list of devices

    mutex_unlock(&fs_info->chunk_mutex)
    mutex_unlock(&fs_info->fs_devices->device_list_mutex)
    mutex_unlock(&uuid_mutex)

    btrfs_rm_dev_replace_free_srcdev()
    --> frees the source device

    --> iterates over all stripes
    of the returned struct
    btrfs_bio
    --> for each stripe it
    dereferences its device
    pointer
    --> it ends up finding a
    pointer to the device
    used as the source
    device for the replace
    operation and that was
    already freed

    So fix this by surrounding the call to btrfs_map_block(), and the code
    that uses the returned struct btrfs_bio, with calls to
    btrfs_bio_counter_inc_blocked() and btrfs_bio_counter_dec(), so that
    the finishing phase of the device replace operation blocks until the
    the bio counter decreases to zero before it frees the source device.
    This is the same approach we do at btrfs_map_bio() for example.

    Signed-off-by: Filipe Manana
    Reviewed-by: Josef Bacik

    Filipe Manana
     
  • For the benefit of every single caller, take osdc instead of map.
    Also, now that osdc->osdmap can't ever be NULL, drop the check.

    Signed-off-by: Ilya Dryomov

    Ilya Dryomov