aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* f2fs: don't allow encrypted operations without keysJaegeuk Kim2017-04-131-0/+12
| | | | | | | | | | This patch fixes the renaming bug on encrypted filenames, which was pointed by (ext4: don't allow encrypted operations without keys) Cc: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: add tmpfile and rename2 to avoid code conflictJaegeuk Kim2017-04-131-0/+252
| | | | Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: show the max number of atomic operationsJaegeuk Kim2017-04-134-2/+31
| | | | | | | | This patch adds to show the max number of atomic operations which are conducting concurrently. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: get io size bit from mount optionJaegeuk Kim2017-04-132-0/+24
| | | | | | This patch adds to set io_size_bits from mount option. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: support IO alignment for DATA and NODE writesJaegeuk Kim2017-04-136-6/+85
| | | | | | | | | | | | | | | This patch implements IO alignment by filling dummy blocks in DATA and NODE write bios. If we can guarantee, for example, 32KB or 64KB for such the IOs, we can eliminate underlying dummy page problem which FTL conducts in order to close MLC or TLC partial written pages. Note that, - it requires "-o mode=lfs". - IO size should be power of 2, not exceed BIO_MAX_PAGES, 256. - read IO is still 4KB. - do checkpoint at fsync, if dummy NODE page was written. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: add submit_bio tracepointJaegeuk Kim2017-04-132-19/+38
| | | | | | | | | | This patch adds final submit_bio() tracepoint. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Conflicts: fs/f2fs/data.c
* f2fs: reassign new segment for mode=lfsJaegeuk Kim2017-04-131-3/+0
| | | | | | Otherwise we can remain wrong curseg->next_blkoff, resulting in fsck failure. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix a missing discard prefree segmentsYunlei He2017-04-131-1/+9
| | | | | | | | | If userspace issue a fstrim with a range not involve prefree segments, it will reuse these segments without discard. This patch fix it. Signed-off-by: Yunlei He <heyunlei@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: use rb_entry_safeGeliang Tang2017-04-132-11/+11
| | | | | | | Use rb_entry_safe() instead of open-coding it. Signed-off-by: Geliang Tang <geliangtang@gmail.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: add a case of no need to read a page in write beginYunlei He2017-04-131-1/+6
| | | | | | | | | If the range we write cover the whole valid data in the last page, we do not need to read it. Signed-off-by: Yunlei He <heyunlei@huawei.com> [Jaegeuk Kim: nullify the remaining area (fix: xfstests/f2fs/001)] Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix a problem of using memory after freeYunlei He2017-04-131-2/+3
| | | | | | | | | | | This patch fix a problem of using memory after free in function __try_merge_extent_node. Fixes: 0f825ee6e873 ("f2fs: add new interfaces for extent tree") Cc: <stable@vger.kernel.org> Signed-off-by: Yunlei He <heyunlei@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: remove unneeded conditionDan Carpenter2017-04-131-3/+3
| | | | | | | | We checked that "inode" is not an error pointer earlier so there is no need to check again here. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: don't cache nat entry if out of memoryChao Yu2017-04-131-7/+20
| | | | | | | | | If we run out of memory, in cache_nat_entry, it's better to avoid loop for allocating memory to cache nat entry, so in low memory scenario, for read path of node block, I expect this can avoid unneeded latency. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: remove unused values in recover_fsync_dataYunlei He2017-04-131-4/+0
| | | | | | | This patch remove unused values in function recover_fsync_data Signed-off-by: Yunlei He <heyunlei@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: add migrate_page to avoid patch conflictsJaegeuk Kim2017-04-135-0/+99
| | | | | | This is disabled by default. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* Revert "f2fs: use percpu_counter for # of dirty pages in inode"Jaegeuk Kim2017-04-133-12/+7
| | | | | | | | | | This reverts commit 1beba1b3a953107c3ff5448ab4e4297db4619c76. The perpcu_counter doesn't provide atomicity in single core and consume more DRAM. That incurs fs_mark test failure due to ENOMEM. Cc: stable@vger.kernel.org # 4.7+ Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: support async discard based on v4.9Jaegeuk Kim2017-04-133-13/+189
| | | | | | This patch is based on commit 275b66b09e85 (f2fs: support async discard). Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: resolve op and op_flags confilctsJaegeuk Kim2017-04-139-53/+98
| | | | Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: use file pointer for fscrypt_notsupp_process_policyJaegeuk Kim2017-04-131-1/+1
| | | | Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* staging: android: ion: Remove ret variable in ion_handle_put_nolockJohanna Abrahamsson2017-04-131-5/+1
| | | | | | | | | | | It is not necessary to save the return value of kref_put since it is directly returned. Change-Id: Id1d2447b4a7f7b802cc001ed78d235808b6dc9f2 Signed-off-by: Johanna Abrahamsson <johanna@mjao.org> Acked-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Corinna Vinschen <xda@vinschen.de>
* sg_write()/bsg_write() is not fit to be called under KERNEL_DSAl Viro2017-04-132-0/+6
| | | | | | | | | | | | Both damn things interpret userland pointers embedded into the payload; worse, they are actually traversing those. Leaving aside the bad API design, this is very much _not_ safe to call with KERNEL_DS. Bail out early if that happens. Change-Id: I383485b4d44970eb61b7178c0b9a4376abfe8cd1 Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Corinna Vinschen <xda@vinschen.de>
* UPSTREAM: seccomp: always propagate NO_NEW_PRIVS on tsyncJann Horn2017-04-131-11/+11
| | | | | | | | | | | | | | | | Before this patch, a process with some permissive seccomp filter that was applied by root without NO_NEW_PRIVS was able to add more filters to itself without setting NO_NEW_PRIVS by setting the new filter from a throwaway thread with NO_NEW_PRIVS. Signed-off-by: Jann Horn <jann@thejh.net> Cc: stable@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Bug: 36656103 (cherry-picked from commit 103502a35cfce0710909da874f092cb44823ca03) Signed-off-by: Paul Lawrence <paullawrence@google.com> Change-Id: I5abd7daab9172f1dfd53e11706b7c7f331f2f4f1
* crypto: af_alg - Allow af_af_alg_release_parent to be called on nokey pathHerbert Xu2017-04-131-0/+6
| | | | | | | | | | | | commit 6a935170a980024dd29199e9dbb5c4da4767a1b9 upstream. This patch allows af_alg_release_parent to be called even for nokey sockets. Cc: stable@vger.kernel.org Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Signed-off-by: Willy Tarreau <w@1wt.eu>
* defconfig: Disable 5ghz in p2p negotiationsMister Oyster2017-04-131-0/+1
|
* gl_p2p_kal: don't dereference 5ghz channels when disabledDiogo Ferreira2017-04-131-0/+2
| | | | | Change-Id: I8b08502528c4c80f813ebc2efc97e06298ca927d Ticket: PORRIDGE-495
* mediatek: wlan: Add an option to disable 5ghz channels for P2PDiogo Ferreira2017-04-132-0/+11
| | | | | | | | | | | | Some devices might contain antennas that can do ap-sta connectivity fine in 5ghz but cannot provide a consistent experience when forming P2P groups. This patch adds a toggle that, when active, disables 5ghz channels in P2P negotiations. Change-Id: I491f1a7973f1248bd50c381d05987d2814b6f7cd Ticket: PORRIDGE-56
* wifi: fix include for meizu kernelMister Oyster2017-04-131-1/+2
|
* mediatek: Update wifi & gps driverfire8552017-04-13948-478541/+128253
| | | | | | | | | Drivers from 3.18 MM kernel Improves wifi connecting speed adapted for m2 note: no ant, no fm driver Signed-off-by: Mister Oyster <oysterized@gmail.com>
* defconfig: build f2fsMister Oyster2017-04-131-0/+5
|
* f2fs: fix a missing size change in f2fs_setattrYunlei He2017-04-131-2/+5
| | | | | | | | This patch fix a missing size change in f2fs_setattr Signed-off-by: Yunlei He <heyunlei@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix to access nullified flush_cmd_control pointerJaegeuk Kim2017-04-133-11/+29
| | | | | | | | | | | | | f2fs_sync_file() remount_ro - f2fs_readonly - destroy_flush_cmd_control - f2fs_issue_flush - no fcc pointer! So, this patch doesn't free fcc in this case, but just stop its kernel thread which sends flush commands. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: free meta pages if sanity check for ckpt is failedJaegeuk Kim2017-04-131-1/+4
| | | | | | This fixes missing freeing meta pages in the error case. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: detect wrong layoutJaegeuk Kim2017-04-132-0/+13
| | | | | | | | | | | | Previous mkfs.f2fs allows small partition inappropriately, so f2fs should detect that as well. Refer this in f2fs-tools. mkfs.f2fs: detect small partition by overprovision ratio and # of segments Reported-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: call sync_fs when f2fs is idleJaegeuk Kim2017-04-131-1/+4
| | | | | | The sync_fs in f2fs_balance_fs_bg must avoid interrupting current user requests. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: return AOP_WRITEPAGE_ACTIVATE for writepageChao Yu2017-04-131-0/+11
| | | | | | | | We should use AOP_WRITEPAGE_ACTIVATE when we bypass writing pages. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Miao Xie <miaoxie@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: do not activate auto_recovery for fallocated i_sizeJaegeuk Kim2017-04-133-20/+31
| | | | | | | | | | | | | | | | | | If a file needs to keep its i_size by fallocate, we need to turn off auto recovery during roll-forward recovery. This will resolve the below scenario. 1. xfs_io -f /mnt/f2fs/file -c "pwrite 0 4096" -c "fsync" 2. xfs_io -f /mnt/f2fs/file -c "falloc -k 4096 4096" -c "fsync" 3. md5sum /mnt/f2fs/file; 4. godown /mnt/f2fs/ 5. umount /mnt/f2fs/ 6. mount -t f2fs /dev/sdx /mnt/f2fs 7. md5sum /mnt/f2fs/file Reported-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix to determine start_cp_addr by sbi->cur_cp_packJaegeuk Kim2017-04-132-11/+23
| | | | | | | | We don't guarantee cp_addr is fixed by cp_version. This is to sync with f2fs-tools. Cc: stable@vger.kernel.org Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix 32-bit buildArnd Bergmann2017-04-131-1/+2
| | | | | | | | | | | | | | | The addition of multiple-device support broke CONFIG_BLK_DEV_ZONED on 32-bit machines because of a 64-bit division: fs/f2fs/f2fs.o: In function `__issue_discard_async': extent_cache.c:(.text.__issue_discard_async+0xd4): undefined reference to `__aeabi_uldivmod' Unfortunately, the sector number is usually a 64-bit number, and we guarantee that bdev_zone_size() returns a power-of-two number. Fixes: 792b84b74b54 ("f2fs: support multiple devices") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: set ->owner for debugfs status file's file_operationsNicolai Stange2017-04-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The struct file_operations instance serving the f2fs/status debugfs file lacks an initialization of its ->owner. This means that although that file might have been opened, the f2fs module can still get removed. Any further operation on that opened file, releasing included, will cause accesses to unmapped memory. Indeed, Mike Marshall reported the following: BUG: unable to handle kernel paging request at ffffffffa0307430 IP: [<ffffffff8132a224>] full_proxy_release+0x24/0x90 <...> Call Trace: [] __fput+0xdf/0x1d0 [] ____fput+0xe/0x10 [] task_work_run+0x8e/0xc0 [] do_exit+0x2ae/0xae0 [] ? __audit_syscall_entry+0xae/0x100 [] ? syscall_trace_enter+0x1ca/0x310 [] do_group_exit+0x44/0xc0 [] SyS_exit_group+0x14/0x20 [] do_syscall_64+0x61/0x150 [] entry_SYSCALL64_slow_path+0x25/0x25 <...> ---[ end trace f22ae883fa3ea6b8 ]--- Fixing recursive fault but reboot is needed! Fix this by initializing the f2fs/status file_operations' ->owner with THIS_MODULE. This will allow debugfs to grab a reference to the f2fs module upon any open on that file, thus preventing it from getting removed. Fixes: 902829aa0b72 ("f2fs: move proc files to debugfs") Reported-by: Mike Marshall <hubcap@omnibond.com> Reported-by: Martin Brandenburg <martin@omnibond.com> Cc: stable@vger.kernel.org Signed-off-by: Nicolai Stange <nicstange@gmail.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix incorrect free inode count in ->statfsChao Yu2017-04-131-1/+2
| | | | | | | | | While calculating inode count that we can create at most in the left space, we should consider space which data/node blocks occupied, since we create data/node mixly in main area. So fix the wrong calculation in ->statfs. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: drop duplicate header timer.hGeliang Tang2017-04-131-1/+0
| | | | | | | Drop duplicate header timer.h from segment.c. Signed-off-by: Geliang Tang <geliangtang@gmail.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix wrong AUTO_RECOVER conditionJaegeuk Kim2017-04-131-1/+2
| | | | | | | If i_size is not aligned to the f2fs's block size, we should not skip inode update during fsync. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: do not recover i_size if it's validJaegeuk Kim2017-04-131-1/+1
| | | | | | | If i_size is already valid during roll_forward recovery, we should not update it according to the block alignment. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix fdatasyncChao Yu2017-04-132-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For below two cases, we can't guarantee data consistence: a) 1. xfs_io "pwrite 0 4195328" "fsync" 2. xfs_io "pwrite 4195328 1024" "fdatasync" 3. godown 4. umount & mount --> isize we updated before fdatasync won't be recovered b) 1. xfs_io "pwrite -S 0xcc 0 4202496" "fsync" 2. xfs_io "fpunch 4194304 4096" "fdatasync" 3. godown 4. umount & mount --> dnode we punched before fdatasync won't be recovered The reason is that normally fdatasync won't be aware of modification of metadata in file, e.g. isize changing, dnode updating, so in ->fsync we will skip flushing node pages for above cases, result in making fdatasynced file being lost during recovery. Currently we have introduced DIRTY_META global list in sbi for tracking dirty inode selectively, so in fdatasync we can choose to flush nodes depend on dirty state of current inode in the list. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix to account total free nid correctlyChao Yu2017-04-132-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thread A Thread B Thread C - f2fs_create - f2fs_new_inode - f2fs_lock_op - alloc_nid alloc last nid - f2fs_unlock_op - f2fs_create - f2fs_new_inode - f2fs_lock_op - alloc_nid as node count still not be increased, we will loop in alloc_nid - f2fs_write_node_pages - f2fs_balance_fs_bg - f2fs_sync_fs - write_checkpoint - block_operations - f2fs_lock_all - f2fs_lock_op While creating new inode, we do not allocate and account nid atomically, so that when there is almost no free nids left, we may encounter deadloop like above stack. In order to avoid that, reuse nm_i::available_nids for accounting free nids and make nid allocation and counting being atomical during node creation. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix an infinite loop when flush nodes in cpYunlei He2017-04-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Thread A Thread B - write_checkpoint - block_operations -blk_start_plug -sync_node_pages - f2fs_do_sync_file - fsync_node_pages - f2fs_wait_on_page_writeback Thread A wait for global F2FS_DIRTY_NODES decreased to zero, it start a plug list, some requests have been added to this list. Thread B lock one dirty node page, and wait this page write back. But this page has been in plug list of thread A with PG_writeback flag. Thread A keep on running and its plug list has no chance to finish, so it seems a deadlock between cp and fsync path. This patch add a wait on page write back before set node page dirty to avoid this problem. Signed-off-by: Yunlei He <heyunlei@huawei.com> Signed-off-by: Pengyang Hou <houpengyang@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: don't wait writeback for datas during checkpointChao Yu2017-04-137-18/+40
| | | | | | | | | | | | | | | | | | | Normally, while committing checkpoint, we will wait on all pages to be writebacked no matter the page is data or metadata, so in scenario where there are lots of data IO being submitted with metadata, we may suffer long latency for waiting writeback during checkpoint. Indeed, we only care about persistence for pages with metadata, but not pages with data, as file system consistent are only related to metadate, so in order to avoid encountering long latency in above scenario, let's recognize and reference metadata in submitted IOs, wait writeback only for metadatas. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Conflicts: fs/f2fs/data.c
* f2fs: fix wrong written_valid_blocks countingJaegeuk Kim2017-04-131-2/+4
| | | | | | | | Previously, written_valid_blocks was got by ckpt->valid_block_count. But if the last checkpoint has some NEW_ADDR due to power-cut, we can get wrong value. Fix it to get the number from actual written block count from sit entries. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: avoid BG_GC in f2fs_balance_fsJaegeuk Kim2017-04-134-5/+8
| | | | | | | | | If many threads hit has_not_enough_free_secs() in f2fs_balance_fs() at the same time, all the threads would do FG_GC or BG_GC. In this critical path, we totally don't need to do BG_GC at all. Let's avoid that. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs: fix redundant block allocationJaegeuk Kim2017-04-131-6/+12
| | | | | | | | | | | | | | | | | | In direct_IO path of f2fs_file_write_iter(), 1. f2fs_preallocate_blocks(F2FS_GET_BLOCK_PRE_DIO) -> allocate LBA X 2. f2fs_direct_IO() -> return 0; Then, f2fs_write_data_page() will allocate another LBA X+1. This makes EIO triggered by HM-SMR. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Conflicts: fs/f2fs/data.c