Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request #1

Closed
wants to merge 30 commits into from
Closed

Pull request #1

wants to merge 30 commits into from

Commits on Sep 29, 2015

  1. Btrfs: rename btrfs_sysfs_add_one to btrfs_sysfs_add_mounted

    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Sep 29, 2015
    Configuration menu
    Copy the full SHA
    96f3136 View commit details
    Browse the repository at this point in the history
  2. Btrfs: rename btrfs_sysfs_remove_one to btrfs_sysfs_remove_mounted

    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Sep 29, 2015
    Configuration menu
    Copy the full SHA
    6618a59 View commit details
    Browse the repository at this point in the history
  3. Btrfs: rename btrfs_kobj_add_device to btrfs_sysfs_add_device_link

    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Sep 29, 2015
    Configuration menu
    Copy the full SHA
    e3bd697 View commit details
    Browse the repository at this point in the history
  4. Btrfs: rename btrfs_kobj_rm_device to btrfs_sysfs_rm_device_link

    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Sep 29, 2015
    Configuration menu
    Copy the full SHA
    3257604 View commit details
    Browse the repository at this point in the history
  5. Btrfs: rename super_kobj to fsid_kobj

    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Sep 29, 2015
    Configuration menu
    Copy the full SHA
    c1b7e47 View commit details
    Browse the repository at this point in the history
  6. Btrfs: SB read failure should return EIO for __bread failure

    This will return EIO when __bread() fails to read SB,
    instead of EINVAL.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Sep 29, 2015
    Configuration menu
    Copy the full SHA
    92fc03f View commit details
    Browse the repository at this point in the history
  7. Btrfs: __btrfs_std_error() logic should be consistent w/out CONFIG_PR…

    …INTK defined
    
    error handling logic behaves differently with or without
    CONFIG_PRINTK defined, since there are two copies of the same
    function which a bit of different logic
    
    One, when CONFIG_PRINTK is defined, code is
    
    __btrfs_std_error(..)
    {
    ::
           save_error_info(fs_info);
           if (sb->s_flags & MS_BORN)
                   btrfs_handle_error(fs_info);
    }
    
    and two when CONFIG_PRINTK is not defined, the code is
    
    __btrfs_std_error(..)
    {
    ::
           if (sb->s_flags & MS_BORN) {
                   save_error_info(fs_info);
                   btrfs_handle_error(fs_info);
            }
    }
    
    I doubt if this was intentional ? and appear to have caused since
    we maintain two copies of the same function and they got diverged
    with commits.
    
    Now to decide which logic is correct reviewed changes as below,
    
     533574c
    Commit added two copies of this function
    
     cf79ffb
    Commit made change to only one copy of the function and to the
    copy when CONFIG_PRINTK is defined.
    
    To fix this, instead of maintaining two copies of same function
    approach, maintain single function, and just put the extra
    portion of the code under CONFIG_PRINTK define.
    
    This patch just does that. And keeps code of with CONFIG_PRINTK
    defined.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Sep 29, 2015
    Configuration menu
    Copy the full SHA
    57d816a View commit details
    Browse the repository at this point in the history
  8. Btrfs: consolidate btrfs_error() to btrfs_std_error()

    btrfs_error() and btrfs_std_error() does the same thing
    and calls _btrfs_std_error(), so consolidate them together.
    And the main motivation is that btrfs_error() is closely
    named with btrfs_err(), one handles error action the other
    is to log the error, so don't closely name them.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    Suggested-by: David Sterba <dsterba@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Sep 29, 2015
    Configuration menu
    Copy the full SHA
    a4553fe View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2015

  1. Btrfs: use BTRFS_ERROR_DEV_MISSING_NOT_FOUND when missing device is n…

    …ot found
    
    Use btrfs specific error code BTRFS_ERROR_DEV_MISSING_NOT_FOUND instead
    of -ENOENT.  Next this removes the logging when user specifies "missing"
    and we don't find it in the kernel device list. Logging are for system
    events not for user input errors.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Oct 1, 2015
    Configuration menu
    Copy the full SHA
    d74a625 View commit details
    Browse the repository at this point in the history
  2. Btrfs: add btrfs_read_dev_one_super() to read one specific SB

    This uses a chunk of code from btrfs_read_dev_super() and creates
    a function called btrfs_read_dev_one_super() so that next patch
    can use it for scratch superblock.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    [renamed bufhead to bh]
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Oct 1, 2015
    Configuration menu
    Copy the full SHA
    29c36d7 View commit details
    Browse the repository at this point in the history
  3. Btrfs: enhance btrfs_scratch_superblock to scratch all superblocks

    This patch updates and renames btrfs_scratch_superblocks, (which is used
    by the replace device thread), with those fixes from the scratch
    superblock code section of btrfs_rm_device(). The fixes are:
      Scratch all copies of superblock
      Notify kobject that superblock has been changed
      Update time on the device
    
    So that btrfs_rm_device() can use the function
    btrfs_scratch_superblocks() instead of its own scratch code. And further
    replace deivce code which similarly releases device back to the system,
    will have the fixes from the btrfs device delete.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    [renamed to btrfs_scratch_superblock]
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Oct 1, 2015
    Configuration menu
    Copy the full SHA
    12b1c26 View commit details
    Browse the repository at this point in the history
  4. Btrfs: kernel operation should come after user input has been verified

    By general rule of thumb there shouldn't be any way that user land
    could trigger a kernel operation just by sending wrong arguments.
    
    Here do commit cleanups after user input has been verified.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Oct 1, 2015
    Configuration menu
    Copy the full SHA
    9e271ae View commit details
    Browse the repository at this point in the history
  5. Btrfs: don't log error from btrfs_get_bdev_and_sb

    Originally the message was not in a helper but ended up there. We should
    print error messages from callers instead.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    [reworded subject and changelog]
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Oct 1, 2015
    Configuration menu
    Copy the full SHA
    097efc9 View commit details
    Browse the repository at this point in the history
  6. Btrfs: add helper for closing one device

    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    [reworded subject and changelog]
    Signed-off-by: David Sterba <dsterba@suse.com>
    asj authored and kdave committed Oct 1, 2015
    Configuration menu
    Copy the full SHA
    f190aa4 View commit details
    Browse the repository at this point in the history
  7. Btrfs: move kobj stuff out of dev_replace lock range

    To avoid deadlock described in commit 084b6e7 ("btrfs: Fix a
    lockdep warning when running xfstest."), we should move kobj stuff out
    of dev_replace lock range.
    
      "It is because the btrfs_kobj_{add/rm}_device() will call memory
      allocation with GFP_KERNEL,
      which may flush fs page cache to free space, waiting for it self to do
      the commit, causing the deadlock.
    
      To solve the problem, move btrfs_kobj_{add/rm}_device() out of the
      dev_replace lock range, also involing split the
      btrfs_rm_dev_replace_srcdev() function into remove and free parts.
    
      Now only btrfs_rm_dev_replace_remove_srcdev() is called in dev_replace
      lock range, and kobj_{add/rm} and btrfs_rm_dev_replace_free_srcdev() are
      called out of the lock range."
    
    Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    [added lockup description]
    Signed-off-by: David Sterba <dsterba@suse.com>
    Liu Bo authored and kdave committed Oct 1, 2015
    Configuration menu
    Copy the full SHA
    73416da View commit details
    Browse the repository at this point in the history

Commits on Oct 7, 2015

  1. Btrfs: pass the error code to the btrfs_std_error and log ret

    This patch will log return value of add/del_qgroup_relation()
    and pass the err code of btrfs_run_qgroups to the btrfs_std_error().
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    0aee754 View commit details
    Browse the repository at this point in the history
  2. Btrfs: create a helper function to read the disk super

    A part of code from btrfs_scan_one_device() is moved to a new
    function btrfs_read_disk_super(), so that former function looks
    cleaner and moves the code to ensure null terminating label to it as well.
    Further there is opportunity to merge various duplicate
    code on read disk super. Earlier attempt on this was highlighted
    that there was some issues for which there are multiple versions,
    however it was not clear what was issue. So until its worked out
    we can keep it in a separate function.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    8758f87 View commit details
    Browse the repository at this point in the history
  3. btrfs: maintain consistency in logging to help debugging

    Optional Label may or may not be set, or it might be set at
    some time later. However while debugging to search
    through the kernel logs the scripts would need the logs to
    be consistent, so logs search key words shouldn't depend on the
    optional variables, instead fsid is better.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    a964fac View commit details
    Browse the repository at this point in the history
  4. Btrfs: device path change must be logged

    From the issue diagnosable point of view, log if the device path is
    changed.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    defa97a View commit details
    Browse the repository at this point in the history
  5. Btrfs: add missing brelse when superblock checksum fails

    looks like oversight, call brelse() when checksum fails.
    further down the code in the non error path we do call
    brelse() and so we don't see brelse() in the goto error..
    paths.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    e6aea8e View commit details
    Browse the repository at this point in the history
  6. Btrfs: optimize check for stale device

    optimize check for stale device to only be checked when there
    is device added or changed. If there is no update to the
    device, there is no need to call btrfs_free_stale_device().
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    0812a51 View commit details
    Browse the repository at this point in the history
  7. Btrfs: sysfs: support seed devices in the sysfs layout

    This adds an enhancement to show the seed fsid and its devices
    on the btrfs sysfs.
    
    The way sprouting handles fs_devices:
          clone seed fs_devices and add to the fs_uuids
          mem copy seed fs_devices and assign to fs_devices->seed (move dev_list)
          evacuate seed fs_devices contents to hold sprout fs devices contents
    
      So to be inline with this fs_devices changes during seeding,
      represent seed fsid under the sprout fsid, this is achieved
      by using the kobject_move()
      The end result will be,
        /sys/fs/btrfs/sprout-fsid/seed/level-1-seed-fsid/seed/(if)level-2-seed-fsid
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    bd74b0d View commit details
    Browse the repository at this point in the history
  8. Btrfs: create a framework to create pool attributes

    We need fsid kobject to hold pool attributes however
    its created only when fs is mounted. So, this patch
    changes the life cycle of the fsid and devices kobjects
    /sys/fs/btrfs/<fsid> and /sys/fs/btrfs/<fsid>/devices,
    from created and destroyed by mount and unmount event
    to created and destroyed by scanned and module-unload
    events respectively.
    
    However this does not alter life cycle of fs attributes as such.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    b0b3990 View commit details
    Browse the repository at this point in the history
  9. Btrfs: create helper function __check_raid_min_devices()

    move a section of btrfs_rm_device() code to check for min number
    of the devices into the function __check_raid_min_devices()
    
    v2: commit update and title renamed from
        Btrfs: move check for min number of devices to a function
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    0efce14 View commit details
    Browse the repository at this point in the history
  10. Btrfs: clean up and optimize __check_raid_min_device()

    __check_raid_min_device() which was pealed from btrfs_rm_device()
    maintianed its original code to show the block move. This patch
    cleans up __check_raid_min_device().
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    3f7d4c2 View commit details
    Browse the repository at this point in the history
  11. Btrfs: create helper btrfs_find_device_by_user_input()

    The patch renames btrfs_dev_replace_find_srcdev() to
    btrfs_find_device_by_user_input() and moves it to volumes.c.
    so that delete device can use it.
    
    v2: changed title from
        'Btrfs: create rename btrfs_dev_replace_find_srcdev()'
        and commit update
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    504bed3 View commit details
    Browse the repository at this point in the history
  12. Btrfs: make use of btrfs_find_device_by_user_input()

    btrfs_rm_device() has a section of the code which can be replaced
    btrfs_find_device_by_user_input()
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    b737e10 View commit details
    Browse the repository at this point in the history
  13. Btrfs: enhance btrfs_find_device_by_user_input() to check device path

    The operation of device replace and device delete follows same steps
    upto some depth with in btrfs kernel, however they don't share codes.
    This enhancement will help replace and delete to share codes.
    
    Btrfs: enhance check device_path in btrfs_find_device_by_user_input()
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    427d077 View commit details
    Browse the repository at this point in the history
  14. Btrfs: make use of btrfs_scratch_superblocks() in btrfs_rm_device()

    With the previous patches now the btrfs_scratch_superblocks()
    is ready to be used in btrfs_rm_device() so use it.
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    cef4787 View commit details
    Browse the repository at this point in the history
  15. Btrfs: Introduce device delete by devid

    This introduces new ioctl BTRFS_IOC_RM_DEV_V2, which uses
    enhanced struct btrfs_ioctl_vol_args_v2 to carry devid as
    an user argument.
    
    The patch won't delete the old ioctl interface and remains
    backward compatible with user land progs.
    
    Test case/script:
    echo "0 $(blockdev --getsz /dev/sdf) linear /dev/sdf 0" | dmsetup create bad_disk
    mkfs.btrfs -f -d raid1 -m raid1 /dev/sdd /dev/sde /dev/mapper/bad_disk
    mount /dev/sdd /btrfs
    dmsetup suspend bad_disk
    echo "0 $(blockdev --getsz /dev/sdf) error /dev/sdf 0" | dmsetup load bad_disk
    dmsetup resume bad_disk
    echo "bad disk failed. now deleting/replacing"
    btrfs dev del  3  /btrfs
    echo $?
    btrfs fi show /btrfs
    umount /btrfs
    btrfs-show-super /dev/sdd | egrep num_device
    dmsetup remove bad_disk
    wipefs -a /dev/sdf
    
    Signed-off-by: Anand Jain <anand.jain@oracle.com>
    Reported-by: Martin <m_btrfs@ml1.co.uk>
    asj committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    497198c View commit details
    Browse the repository at this point in the history