1. 04 Aug, 2017 3 commits
  2. 31 Jul, 2017 10 commits
    • Chao Yu's avatar
      f2fs: introduce f2fs_statfs_project · ddc34e32
      Chao Yu authored
      This patch introduces f2fs_statfs_project, it enables to show usage
      status of directory tree which is limited with project quota.
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      ddc34e32
    • Chao Yu's avatar
      f2fs: support F2FS_IOC_FS{GET,SET}XATTR · 2c1d0305
      Chao Yu authored
      This patch adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR ioctl interface
      support for f2fs. The interface is kept consistent with the one
      of ext4/xfs.
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      2c1d0305
    • Jaegeuk Kim's avatar
      f2fs: don't need to wait for node writes for atomic write · b6a245eb
      Jaegeuk Kim authored
      We have a node chain to serialize node block writes, so if any IOs for
      node block writes are reordered, we'll get broken node chain. IOWs,
      roll-forward recovery will see all or none node blocks given fsync
      mark.
      
      E.g.,
      Node chain consists of:
       N1 -> N2 -> N3 -> NFSYNC -> N1' -> N2' -> N'FSYNC
      
      Reordered to:
      1) N1 -> N2 -> N3 -> N2' -> NFSYNC -> N'FSYNC -> power-cut
      2) N1 -> N2 -> N3 -> N1' -> NFSYNC -> power-cut
      3) N1 -> N2 -> NFSYNC -> N1' -> N'FSYNC -> N3 -> power-cut
      4) N1 -> NFSYNC -> N1' -> N2' -> N'FSYNC -> N3 -> power-cut
      
      Roll-forward recovery can proceed to:
      1) N1 -> N2 -> N3 -> NFSYNC -> X
      2) N1 -> N2 -> N3 -> NFSYNC -> N1' -> X
      3) N1 -> N2 -> N3 -> FSYNC -> N1' -> X
      4) N1 -> X
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      b6a245eb
    • Jaegeuk Kim's avatar
      f2fs: avoid naming confusion of sysfs init · dc6b2055
      Jaegeuk Kim authored
      This patch changes the function names of sysfs init to follow ext4.
      
      f2fs_init_sysfs <-> f2fs_register_sysfs
      f2fs_exit_sysfs <-> f2fs_unregister_sysfs
      Suggested-by: default avatarChao Yu <yuchao0@huawei.com>
      Reivewed-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      dc6b2055
    • Chao Yu's avatar
      f2fs: support project quota · 5c57132e
      Chao Yu authored
      This patch adds to support plain project quota.
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      5c57132e
    • Chao Yu's avatar
      f2fs: record quota during dot{,dot} recovery · a6d3a479
      Chao Yu authored
      In ->lookup(), we will have a try to recover dot or dotdot for
      corrupted directory, once disk quota is on, if it allocates new
      block during dotdot recovery, we need to record disk quota info
      for the allocation, so this patch fixes this issue by adding
      missing dquot_initialize() in __recover_dot_dentries.
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      a6d3a479
    • Chao Yu's avatar
      f2fs: enhance on-disk inode structure scalability · 7a2af766
      Chao Yu authored
      This patch add new flag F2FS_EXTRA_ATTR storing in inode.i_inline
      to indicate that on-disk structure of current inode is extended.
      
      In order to extend, we changed the inode structure a bit:
      
      Original one:
      
      struct f2fs_inode {
      	...
      	struct f2fs_extent i_ext;
      	__le32 i_addr[DEF_ADDRS_PER_INODE];
      	__le32 i_nid[DEF_NIDS_PER_INODE];
      }
      
      Extended one:
      
      struct f2fs_inode {
              ...
              struct f2fs_extent i_ext;
      	union {
      		struct {
      			__le16 i_extra_isize;
      			__le16 i_padding;
      			__le32 i_extra_end[0];
      		};
      		__le32 i_addr[DEF_ADDRS_PER_INODE];
      	};
              __le32 i_nid[DEF_NIDS_PER_INODE];
      }
      
      Once F2FS_EXTRA_ATTR is set, we will steal four bytes in the head of
      i_addr field for storing i_extra_isize and i_padding. with i_extra_isize,
      we can calculate actual size of reserved space in i_addr, available
      attribute fields included in total extra attribute fields for current
      inode can be described as below:
      
        +--------------------+
        | .i_mode            |
        | ...                |
        | .i_ext             |
        +--------------------+
        | .i_extra_isize     |-----+
        | .i_padding         |     |
        | .i_prjid           |     |
        | .i_atime_extra     |     |
        | .i_ctime_extra     |     |
        | .i_mtime_extra     |<----+
        | .i_inode_cs        |<----- store blkaddr/inline from here
        | .i_xattr_cs        |
        | ...                |
        +--------------------+
        |                    |
        |    block address   |
        |                    |
        +--------------------+
        | .i_nid             |
        +--------------------+
        |   node_footer      |
        | (nid, ino, offset) |
        +--------------------+
      
      Hence, with this patch, we would enhance scalability of f2fs inode for
      storing more newly added attribute.
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      7a2af766
    • Chao Yu's avatar
      f2fs: make max inline size changeable · f2470371
      Chao Yu authored
      This patch tries to make below macros calculating max inline size,
      inline dentry field size considerring reserving size-changeable
      space:
      - MAX_INLINE_DATA
      - NR_INLINE_DENTRY
      - INLINE_DENTRY_BITMAP_SIZE
      - INLINE_RESERVED_SIZE
      
      Then, when inline_{data,dentry} options is enabled, it allows us to
      reserve inline space with different size flexibly for adding newly
      introduced inode attribute.
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      f2470371
    • Jaegeuk Kim's avatar
      f2fs: add ioctl to expose current features · e65ef207
      Jaegeuk Kim authored
      This patch adds an ioctl to provide feature information to user.
      For exapmle, SQLite can use this ioctl to detect whether f2fs support atomic
      write or not.
      Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      e65ef207
    • Chao Yu's avatar
      f2fs: make background threads of f2fs being aware of freezing · dc6febb6
      Chao Yu authored
      When ->freeze_fs is called from lvm for doing snapshot, it needs to
      make sure there will be no more changes in filesystem's data, however,
      previously, background threads like GC thread wasn't aware of freezing,
      so in environment with active background threads, data of snapshot
      becomes unstable.
      
      This patch fixes this issue by adding sb_{start,end}_intwrite in
      below background threads:
      - GC thread
      - flush thread
      - discard thread
      
      Note that, don't use sb_start_intwrite() in gc_thread_func() due to:
      
      generic/241 reports below bug:
      
       ======================================================
       WARNING: possible circular locking dependency detected
       4.13.0-rc1+ #32 Tainted: G           O
       ------------------------------------------------------
       f2fs_gc-250:0/22186 is trying to acquire lock:
        (&sbi->gc_mutex){+.+...}, at: [<f8fa7f0b>] f2fs_sync_fs+0x7b/0x1b0 [f2fs]
      
       but task is already holding lock:
        (sb_internal#2){++++.-}, at: [<f8fb5609>] gc_thread_func+0x159/0x4a0 [f2fs]
      
       which lock already depends on the new lock.
      
       the existing dependency chain (in reverse order) is:
      
       -> #2 (sb_internal#2){++++.-}:
              __lock_acquire+0x405/0x7b0
              lock_acquire+0xae/0x220
              __sb_start_write+0x11d/0x1f0
              f2fs_evict_inode+0x2d6/0x4e0 [f2fs]
              evict+0xa8/0x170
              iput+0x1fb/0x2c0
              f2fs_sync_inode_meta+0x3f/0xf0 [f2fs]
              write_checkpoint+0x1b1/0x750 [f2fs]
              f2fs_sync_fs+0x85/0x1b0 [f2fs]
              f2fs_do_sync_file.isra.24+0x137/0xa30 [f2fs]
              f2fs_sync_file+0x34/0x40 [f2fs]
              vfs_fsync_range+0x4a/0xa0
              do_fsync+0x3c/0x60
              SyS_fdatasync+0x15/0x20
              do_fast_syscall_32+0xa1/0x1b0
              entry_SYSENTER_32+0x4c/0x7b
      
       -> #1 (&sbi->cp_mutex){+.+...}:
              __lock_acquire+0x405/0x7b0
              lock_acquire+0xae/0x220
              __mutex_lock+0x4f/0x830
              mutex_lock_nested+0x25/0x30
              write_checkpoint+0x2f/0x750 [f2fs]
              f2fs_sync_fs+0x85/0x1b0 [f2fs]
              sync_filesystem+0x67/0x80
              generic_shutdown_super+0x27/0x100
              kill_block_super+0x22/0x50
              kill_f2fs_super+0x3a/0x40 [f2fs]
              deactivate_locked_super+0x3d/0x70
              deactivate_super+0x40/0x60
              cleanup_mnt+0x39/0x70
              __cleanup_mnt+0x10/0x20
              task_work_run+0x69/0x80
              exit_to_usermode_loop+0x57/0x92
              do_fast_syscall_32+0x18c/0x1b0
              entry_SYSENTER_32+0x4c/0x7b
      
       -> #0 (&sbi->gc_mutex){+.+...}:
              validate_chain.isra.36+0xc50/0xdb0
              __lock_acquire+0x405/0x7b0
              lock_acquire+0xae/0x220
              __mutex_lock+0x4f/0x830
              mutex_lock_nested+0x25/0x30
              f2fs_sync_fs+0x7b/0x1b0 [f2fs]
              f2fs_balance_fs_bg+0xb9/0x200 [f2fs]
              gc_thread_func+0x302/0x4a0 [f2fs]
              kthread+0xe9/0x120
              ret_from_fork+0x19/0x24
      
       other info that might help us debug this:
      
       Chain exists of:
         &sbi->gc_mutex --> &sbi->cp_mutex --> sb_internal#2
      
        Possible unsafe locking scenario:
      
              CPU0                    CPU1
              ----                    ----
         lock(sb_internal#2);
                                      lock(&sbi->cp_mutex);
                                      lock(sb_internal#2);
         lock(&sbi->gc_mutex);
      
        *** DEADLOCK ***
      
       1 lock held by f2fs_gc-250:0/22186:
        #0:  (sb_internal#2){++++.-}, at: [<f8fb5609>] gc_thread_func+0x159/0x4a0 [f2fs]
      
       stack backtrace:
       CPU: 2 PID: 22186 Comm: f2fs_gc-250:0 Tainted: G           O    4.13.0-rc1+ #32
       Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
       Call Trace:
        dump_stack+0x5f/0x92
        print_circular_bug+0x1b3/0x1bd
        validate_chain.isra.36+0xc50/0xdb0
        ? __this_cpu_preempt_check+0xf/0x20
        __lock_acquire+0x405/0x7b0
        lock_acquire+0xae/0x220
        ? f2fs_sync_fs+0x7b/0x1b0 [f2fs]
        __mutex_lock+0x4f/0x830
        ? f2fs_sync_fs+0x7b/0x1b0 [f2fs]
        mutex_lock_nested+0x25/0x30
        ? f2fs_sync_fs+0x7b/0x1b0 [f2fs]
        f2fs_sync_fs+0x7b/0x1b0 [f2fs]
        f2fs_balance_fs_bg+0xb9/0x200 [f2fs]
        gc_thread_func+0x302/0x4a0 [f2fs]
        ? preempt_schedule_common+0x2f/0x4d
        ? f2fs_gc+0x540/0x540 [f2fs]
        kthread+0xe9/0x120
        ? f2fs_gc+0x540/0x540 [f2fs]
        ? kthread_create_on_node+0x30/0x30
        ret_from_fork+0x19/0x24
      
      The deadlock occurs in below condition:
      GC Thread			Thread B
      - sb_start_intwrite
      				- f2fs_sync_file
      				 - f2fs_sync_fs
      				  - mutex_lock(&sbi->gc_mutex)
      				   - write_checkpoint
      				    - block_operations
      				     - f2fs_sync_inode_meta
      				      - iput
      				       - sb_start_intwrite
       - mutex_lock(&sbi->gc_mutex)
      
      Fix this by altering sb_start_intwrite to sb_start_write_trylock.
      Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      dc6febb6
  3. 29 Jul, 2017 3 commits
  4. 27 Jul, 2017 3 commits
  5. 26 Jul, 2017 3 commits
  6. 25 Jul, 2017 3 commits
  7. 24 Jul, 2017 3 commits
  8. 23 Jul, 2017 8 commits
  9. 22 Jul, 2017 4 commits
    • Linus Torvalds's avatar
      Merge tag 'hwmon-for-linus-v4.13-rc2' of... · 4b162c53
      Linus Torvalds authored
      Merge tag 'hwmon-for-linus-v4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull hwmon fix from Guenter Roeck:
       "Avoid buffer overruns in applesmc driver"
      
      * tag 'hwmon-for-linus-v4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (applesmc) Avoid buffer overruns
      4b162c53
    • Linus Torvalds's avatar
      Merge tag 'tty-4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · ae75d1ae
      Linus Torvalds authored
      Pull tty/serial fixes from Greg KH:
       "Here are some small tty and serial driver fixes for 4.13-rc2. Nothing
        huge at all, a revert of a patch that turned out to break things, a
        fix up for a new tty ioctl we added in 4.13-rc1 to get the uapi
        definition correct, and a few minor serial driver fixes for reported
        issues.
      
        All of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'tty-4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        tty: Fix TIOCGPTPEER ioctl definition
        tty: hide unused pty_get_peer function
        tty: serial: lpuart: Fix the logic for detecting the 32-bit type UART
        serial: imx: Prevent TX buffer PIO write when a DMA has been started
        Revert "serial: imx-serial - move DMA buffer configuration to DT"
        serial: sh-sci: Uninitialized variables in sysfs files
        serial: st-asc: Potential error pointer dereference
      ae75d1ae
    • Linus Torvalds's avatar
      Merge tag 'char-misc-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · dedaff2f
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "Here are some small char and misc driver fixes for 4.13-rc2. All fix
        reported problems with 4.13-rc1 or older kernels (like the binder
        fixes). Full details in the shortlog.
      
        All have been in linux-next with no reported issues"
      
      * tag 'char-misc-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        w1: omap-hdq: fix error return code in omap_hdq_probe()
        regmap: regmap-w1: Fix build troubles
        w1: Fix slave count on 1-Wire bus (resend)
        mux: mux-core: unregister mux_class in mux_exit()
        mux: remove the Kconfig question for the subsystem
        nvmem: rockchip-efuse: amend compatible rk322x-efuse to rk3228-efuse
        drivers/fsi: fix fsi_slave_mode prototype
        fsi: core: register with postcore_initcall
        thunderbolt: Correct access permissions for active NVM contents
        vmbus: re-enable channel tasklet
        spmi: pmic-arb: Always allocate ppid_to_apid table
        MAINTAINERS: Add entry for SPMI subsystem
        spmi: Include OF based modalias in device uevent
        binder: Use wake up hint for synchronous transactions.
        binder: use group leader instead of open thread
        Revert "android: binder: Sanity check at binder ioctl"
      dedaff2f
    • Linus Torvalds's avatar
      Merge tag 'usb-4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 55fd939e
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are some small USB fixes for 4.13-rc2.
      
        The usual batch, gadget fixes for reported issues, as well as xhci
        fixes, and a small random collection of other fixes for reported
        issues.
      
        All have been in linux-next with no reported issues"
      
      * tag 'usb-4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (25 commits)
        xhci: fix memleak in xhci_run()
        usb: xhci: fix spinlock recursion for USB2 test mode
        xhci: fix 20000ms port resume timeout
        usb: xhci: Issue stop EP command only when the EP state is running
        xhci: Bad Ethernet performance plugged in ASM1042A host
        xhci: Fix NULL pointer dereference when cleaning up streams for removed host
        usb: renesas_usbhs: gadget: disable all eps when the driver stops
        usb: renesas_usbhs: fix usbhsc_resume() for !USBHSF_RUNTIME_PWCTRL
        usb: gadget: udc: renesas_usb3: protect usb3_ep->started in usb3_start_pipen()
        usb: gadget: udc: renesas_usb3: fix zlp transfer by the dmac
        usb: gadget: udc: renesas_usb3: fix free size in renesas_usb3_dma_free_prd()
        usb: gadget: f_uac2: endianness fixes.
        usb: gadget: f_uac1: endianness fixes.
        include: usb: audio: specify exact endiannes of descriptors
        usb: gadget: udc: start_udc() can be static
        usb: dwc2: gadget: On USB RESET reset device address to zero
        usb: storage: return on error to avoid a null pointer dereference
        usb: typec: include linux/device.h in ucsi.h
        USB: cdc-acm: add device-id for quirky printer
        usb: dwc3: gadget: only unmap requests from DMA if mapped
        ...
      55fd939e