Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed commit of the following: commit 869d61cda160f0e824032c84aa5ac041639f5e24 Author: Scott Mertz <scott@cyngn.com> Date: Fri Jun 10 10:24:28 2016 -0700 BACKPORT: f2fs: add a max block check for get_data_block_bmap (cherry pick from commit 179448bfe4cd201e98e728391c6b01b25c849fe8) This patch adds a max block check for get_data_block_bmap. Trinity test program will send a block number as parameter into ioctl_fibmap, which will be used in get_node_path(), when the block number large than f2fs max blocks, it will trigger kernel bug. Signed-off-by: Yunlei He <heyunlei@huawei.com> Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com> [Jaegeuk Kim: fix missing condition, pointed by Chao Yu] Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Change-Id: Ia3d24f23735c73bf1dc2c885512afcc393d2ba25 commit d162ca69fefad82d965f8a9335c1c546a82ff9ea Author: Keith Mok <kmok@cyngn.com> Date: Mon Feb 29 14:54:35 2016 -0800 f2fs: Use crypto crc32 functions The crc function is done bit by bit and painfully slow, switch to use crypto crc32 function which is backed by h/w/ acceleration. Change-Id: I653b0d11d06db5aaae181fef15e67840d29edbca commit 546d80887c268311b75cc5b56d359cb6c9d42fb5 Author: Keith Mok <kmok@cyngn.com> Date: Mon Jan 18 14:19:37 2016 -0800 f2fs: Backport v4.4-rc8 Fix f2fs to make it build for 3.10 Change-Id: I38fbd1dfcdfd4293d93ceb54a45ba06a2793c8b9 commit 23348e15b5315a11949f7f95d5cf0bc1c3ea4e54 Author: Keith Mok <kmok@cyngn.com> Date: Mon Jan 18 13:39:41 2016 -0800 f2fs: catch up to v4.4-rc8 The last patch is: commit 5d2eb548b309be34ecf3b91f0b7300a2b9d09b8c Merge: 2870f6c 29608d2 Author: Linus Torvalds <torvalds@linux-foundation.org> Date: Fri Nov 13 18:02:30 2015 -0800 Merge branch 'for-linus-3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs Pull vfs xattr cleanups from Al Viro. * 'for-linus-3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: f2fs: xattr simplifications squashfs: xattr simplifications 9p: xattr simplifications xattr handlers: Pass handler to operations instead of flags jffs2: Add missing capability check for listing trusted xattrs hfsplus: Remove unused xattr handler list operations ubifs: Remove unused security xattr handler vfs: Fix the posix_acl_xattr_list return value vfs: Check attribute names in posix acl xattr handers Change-Id: I91363c68f2d4f1b0a8228bbbc2b8dcf9e2d93137 commit a66078e9dad2c760dfea9232d5a1cb77db0a2065 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Thu May 28 18:19:17 2015 -0700 f2fs: fix a deadlock for summary page lock vs. sentry_lock In f2fs_gc: In f2fs_replace_block: - lock_page(sum_page) - check_valid_map() - mutex_lock(sentry_lock) - mutex_lock(sentry_lock) - change_curseg() - lock_page(sum_page) This patch fixes the deadlock condition. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 116ad121a93688ec612ec027ae11c982109c5269 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Thu May 28 17:06:40 2015 -0700 f2fs crypto: clean up error handling in f2fs_fname_setup_filename Sync with: ext4 crypto: clean up error handling in ext4_fname_setup_filename Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit b74cd9ec13d46b69dc133c4c55893e8a4ed17f54 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Sat May 30 04:00:15 2015 +0300 f2fs: support 3.10 Conflicts: fs/f2fs/data.c fs/f2fs/file.c fs/f2fs/namei.c Change-Id: I2540749a14e6c9f1788a09a06afd586b691f0edd Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit bbc554deecde3c026d45b0f1d8b440867f296ec4 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed May 27 19:51:42 2015 -0700 f2fs crypto: avoid f2fs_inherit_context for symlink This patch fixes to call f2fs_inherit_context twice for newly created symlink. The original one is called by f2fs_add_link(), which invokes f2fs_setxattr. If the second one is called again, f2fs_setxattr is triggered again with same encryption index. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 7b5d4613056bcae3273688c7387e296bc85dfd2f Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed May 20 19:12:30 2015 -0700 f2fs crypto: introduce a mempool for bounce pages If a lot of write streams are triggered, alloc_page and __free_page are costly called, resulting in high memory pressure. In order to avoid that, this patch introduces an additional mempool for writeback pages. Note that, the existing mempool is used for the emergency purpose. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 9748515b5cda4e36a5909a220e9b004c98280d6a Author: Chao Yu <chao2.yu@samsung.com> Date: Wed May 27 15:27:49 2015 +0800 f2fs crypto: do not set encryption policy for non-directory by ioctl Encryption policy should only be set to an empty directory through ioctl, This patch add a judgement condition to verify type of the target inode to avoid incorrectly configuring for non-directory. Additionally, remove unneeded inline data conversion since regular or symlink file should not be processed here. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 3d0c5ba34a3b827b1ed6fb7d4df0da6f11bd7251 Author: Chao Yu <chao2.yu@samsung.com> Date: Mon May 25 18:09:03 2015 +0800 f2fs crypto: allow setting encryption policy once This patch add XATTR_CREATE flag in setxattr when setting encryption context for inode. Without this flag the context could be set more than once, this should never happen. So, fix it. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 02bfdd3df8279d4a31431cede82c6eb8da852a2c Author: Chao Yu <chao2.yu@samsung.com> Date: Mon May 25 18:07:02 2015 +0800 f2fs crypto: check context consistent for rename2 For exchange rename, we should check context consistent of encryption between new_dir and old_inode or old_dir and new_inode. Otherwise inheritance of parent's encryption context will be broken. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit e829d7e3bc102879bec9b755906a60742cf9d930 Author: Chao Yu <chao2.yu@samsung.com> Date: Mon May 25 18:03:38 2015 +0800 f2fs: avoid duplicated code by reusing f2fs_read_end_io This patch tries to clean up code because part code of f2fs_read_end_io and mpage_end_io are the same, so it's better to merge and reuse them. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit a318ba8662f5a41b95e751fe617a7ae75a92b1d6 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Tue May 19 22:26:54 2015 -0700 f2fs crypto: use per-inode tfm structure This patch applies the following ext4 patch: ext4 crypto: use per-inode tfm structure As suggested by Herbert Xu, we shouldn't allocate a new tfm each time we read or write a page. Instead we can use a single tfm hanging off the inode's crypt_info structure for all of our encryption needs for that inode, since the tfm can be used by multiple crypto requests in parallel. Also use cmpxchg() to avoid races that could result in crypt_info structure getting doubly allocated or doubly freed. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 11125bb53eb78f8d346e22995d990ab5cccbd9d3 Author: hujianyang <hujianyang@huawei.com> Date: Thu May 21 14:42:53 2015 +0800 f2fs: recovering broken superblock during mount This patch recovers a broken superblock with the other valid one. Signed-off-by: hujianyang <hujianyang@huawei.com> [Jaegeuk Kim: reinitialize local variables in f2fs_fill_super for retrial] Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 0581fe2dd6c59599aaed98f970a649c2c4ee6a2d Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Tue May 19 16:11:40 2015 -0700 f2fs crypto: check encryption for tmpfile This patch adds to check encryption for tmpfile in early stage. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 9779b9015d454a8a23f329c315e0582e0b01796c Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Sat May 30 03:57:24 2015 +0300 f2fs: support RENAME_WHITEOUT As the description of rename in manual, RENAME_WHITEOUT is a special operation that only makes sense for overlay/union type filesystem. When performing rename with RENAME_WHITEOUT, dst will be replace with src, and meanwhile, a 'whiteout' will be create with name of src. A "whiteout" is designed to be a char device with 0,0 device number, it has specially meaning for stackable filesystem. In these filesystems, there are multiple layers exist, and only top of these can be modified. So a whiteout in top layer is used to hide a corresponding file in lower layer, as well removal of whiteout will make the file appear. Now in overlayfs, when we rename a file which is exist in lower layer, it will be copied up to upper if it is not on upper layer yet, and then rename it on upper layer, source file will be whiteouted to hide corresponding file in lower layer at the same time. So in upper layer filesystem, implementation of RENAME_WHITEOUT provide a atomic operation for stackable filesystem to support rename operation. There are multiple ways to implement RENAME_WHITEOUT in log of this commit: 7dcf5c3e4527 ("xfs: add RENAME_WHITEOUT support") which pointed out by Dave Chinner. For now, we just try to follow the way that xfs/ext4 use. Conflicts: fs/f2fs/namei.c Change-Id: Iac408db95a4133ac04c7d612ae06771afe238349 Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 832a7efd1724c4d896e64ab35df66514c27b7f15 Author: Chao Yu <chao2.yu@samsung.com> Date: Tue May 19 17:40:04 2015 +0800 f2fs: introduce update_meta_page Add a help function update_meta_page() to update meta page with specified buffer. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit a3c1fc3eba871337cebf74f6ed8d3a087e22e0b3 Author: Chao Yu <chao2.yu@samsung.com> Date: Mon May 18 18:00:06 2015 +0800 f2fs crypto: zero next free dnode block Now page cache of meta inode is used by garbage collection for encrypted page, it may contain random data, so we should zero it before issuing discard. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 02a47222f7b5ca017e6e5a8728502c06bf3cf42f Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Fri May 15 15:37:24 2015 -0700 f2fs crypto: split f2fs_crypto_init/exit with two parts This patch splits f2fs_crypto_init/exit with two parts: base initialization and memory allocation. Firstly, f2fs module declares the base encryption memory pointers. Then, allocating internal memories is done at the first encrypted inode access. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 41640159159e81a9549554fc7a4eef1f8b7d793d Author: Chao Yu <chao2.yu@samsung.com> Date: Fri May 15 11:14:34 2015 +0800 f2fs crypto: fix incorrect release for crypto ctx When encryption feature is enable, if we rmmod f2fs module, we will encounter a stack backtrace reported in syslog: "BUG: Bad page state in process rmmod pfn:aaf8a page:f0f4f148 count:0 mapcount:129 mapping:ee2f4104 index:0x80 flags: 0xee2830a4(referenced|lru|slab|private_2|writeback|swapbacked|mlocked) page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set bad because of flags: flags: 0x2030a0(lru|slab|private_2|writeback|mlocked) Modules linked in: f2fs(O-) fuse bnep rfcomm bluetooth dm_crypt binfmt_misc snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer snd_seq_device joydev ppdev mac_hid lp hid_generic i2c_piix4 parport_pc psmouse snd serio_raw parport soundcore ext4 jbd2 mbcache usbhid hid e1000 [last unloaded: f2fs] CPU: 1 PID: 3049 Comm: rmmod Tainted: G B O 4.1.0-rc3+ #10 Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 00000000 00000000 c0021eb4 c15b7518 f0f4f148 c0021ed8 c112e0b7 c1779174 c9b75674 000aaf8a 01b13ce1 c17791a4 f0f4f148 ee2830a4 c0021ef8 c112e3c3 00000000 f0f4f148 c0021f34 f0f4f148 ee2830a4 ef9f0000 c0021f20 c112fdf8 Call Trace: [<c15b7518>] dump_stack+0x41/0x52 [<c112e0b7>] bad_page.part.72+0xa7/0x100 [<c112e3c3>] free_pages_prepare+0x213/0x220 [<c112fdf8>] free_hot_cold_page+0x28/0x120 [<c1073380>] ? try_to_wake_up+0x2b0/0x2b0 [<c112ff15>] __free_pages+0x25/0x30 [<c112c4fd>] mempool_free_pages+0xd/0x10 [<c112c5f1>] mempool_free+0x31/0x90 [<f0f441cf>] f2fs_exit_crypto+0x6f/0xf0 [f2fs] [<f0f456c4>] exit_f2fs_fs+0x23/0x95f [f2fs] [<c10c30e0>] SyS_delete_module+0x130/0x180 [<c11556d6>] ? vm_munmap+0x46/0x60 [<c15bd888>] sysenter_do_call+0x12/0x12" The reason is that: since commit 0827e645fd35 ("f2fs crypto: shrink size of the f2fs_crypto_ctx structure") is merged, some fields in f2fs_crypto_ctx structure are merged into a union as they will never be used simultaneously in write path, read path or on free list. In f2fs_exit_crypto, we traverse each crypto ctx from free list, in this moment, our free_list field in union is valid, but still we will try to release memory space which is pointed by other invalid field in union structure for each ctx. Then the error occurs, let's fix it with this patch. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 402d19ed0be8fb13cd82092aa3902a0d27015551 Author: Chao Yu <chao2.yu@samsung.com> Date: Wed May 13 18:20:54 2015 +0800 f2fs crypto: fix to release buffer for fname crypto This patch fixes memory leak issue in error path of f2fs_fname_setup_filename(). Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit f9f4324ba8e1da3994eb31f44c81e719c4fc49eb Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Tue May 12 13:40:20 2015 -0700 f2fs crypto: shrink size of the f2fs_crypto_ctx structure This patch integrates the below patch into f2fs. "ext4 crypto: shrink size of the ext4_crypto_ctx structure Some fields are only used when the crypto_ctx is being used on the read path, some are only used on the write path, and some are only used when the structure is on free list. Optimize memory use by using a union." Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 695330214abbf0ea33ac04d1e10df79769871e72 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Tue May 12 13:33:00 2015 -0700 f2fs crypto: get rid of ci_mode from struct f2fs_crypt_info This patch integrates the below patch into f2fs. "ext4 crypto: get rid of ci_mode from struct ext4_crypt_info The ci_mode field was superfluous, and getting rid of it gets rid of an unused hole in the structure." Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 8bc541a35a5bf57387007ec523fb4caf8e11eb5f Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Tue May 12 13:26:54 2015 -0700 f2fs crypto: use slab caches This patch integrates the below patch into f2fs. "ext4 crypto: use slab caches Use slab caches the ext4_crypto_ctx and ext4_crypt_info structures for slighly better memory efficiency and debuggability." Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 211ffb46af5bdb0ccd4f7933550f55fa3832d7c7 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed May 13 14:35:14 2015 -0700 f2fs: truncate data blocks for orphan inode As Hu reported, F2FS has a space leak problem, when conducting: 1) format a 4GB f2fs partition 2) dd a 3G file, 3) unlink it. So, when doing f2fs_drop_inode(), we need to truncate data blocks before skipping it. We can also drop unused caches assigned to each inode. Reported-by: hujianyang <hujianyang@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 3bf4f596420b436915247c3ed406e1b56609091c Author: Dan Carpenter <dan.carpenter@oracle.com> Date: Thu May 14 11:52:28 2015 +0300 f2fs: cleanup a confusing indent The return was not indented far enough so it looked like it was supposed to go with the other if statement. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit ad49d0578fd113dcde01f073cae05c5e97690cbd Author: Arnd Bergmann <arnd@arndb.de> Date: Wed May 13 22:49:58 2015 +0200 f2fs: fix building on 32-bit architectures A bug fix to the debug output extended the type of some local variables to 64-bit, which now causes the kernel to fail building because of missing 64-bit division functions: ERROR: "__aeabi_uldivmod" [fs/f2fs/f2fs.ko] undefined! In the kernel, we have to use div_u64 or do_div to do this, in order to annotate that this is an expensive operation. As the function is only called for debug out, we know this is not performance critical, so it is safe to use div_u64. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: d1f85bd38db19 ("f2fs: avoid value overflow in showing current status") Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 5d390f29c5afd9f78c819da8297d8e4ed8b05a0e Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon May 18 11:45:15 2015 -0700 f2fs: avoid buggy functions This patch avoids to use a buggy function for now. It needs to fix them later. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 26320f96a8cc3918d48527b69167d857899e4efa Author: hujianyang <hujianyang@huawei.com> Date: Tue May 12 16:05:57 2015 +0800 f2fs: add compat_ioctl to provide backward compatability introduce compat_ioctl to regular files, but doesn't add this functionality to f2fs_dir_operations. While running a 32-bit busybox, I met an error like this: (A is a directory) chattr: reading flags on A: Inappropriate ioctl for device This patch copies compat_ioctl from f2fs_file_operations and fix this problem. Signed-off-by: hujianyang <hujianyang@huawei.com> Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 9c7dc1f03c8b0cc74de9cb73349c340f07ea6be3 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon May 11 20:03:49 2015 -0700 f2fs: do not issue next dnode discard redundantly We have a discard map, so that we can avoid redundant discard issues. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit f62c1b25a0ba7fd699e397b01d117ce4d77c2dbb Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon May 11 20:02:14 2015 -0700 f2fs: disable the discard option when device does not support This patch disables given discard option when device does not support it. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 0092b3dc467ad4e1ecf6b732a0aa9352f94d7600 Author: Yunlei He <heyunlei@huawei.com> Date: Thu May 7 18:11:37 2015 +0800 f2fs: add default mount options to remount I use f2fs filesystem with /data partition on my Android phone by the default mount options. When I remount /data in order to adding discard option to run some benchmarks, I find the default options such as background_gc, user_xattr and acl turned off. So I introduce a function named default_options in super.c. It do some default setting, and both mount and remount operations will call this function to complete default setting. Signed-off-by: Yunlei He <heyunlei@huawei.com> Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 16fa79a4f39e3250c1282519ca7f97275081a3a1 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed May 6 18:23:21 2015 -0700 f2fs crypto: remove checking key context during lookup No matter what the key is valid or not, readdir shows the dir entries correctly. So, lookup should not failed. But, we expect further accesses should be denied from open, rename, link, and so on. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit dc70a8a153167920018e6f603bde29efee225946 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Tue May 5 20:20:29 2015 -0700 f2fs crypto: fix missing key when reading a page 1. mount $mnt 2. cp data $mnt/ 3. umount $mnt 4. log out 5. log in 6. cat $mnt/data -> panic, due to no i_crypt_info. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit e0a1ff90c374c3a19822d84a2888049723b691a6 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed Apr 29 15:10:53 2015 -0700 f2fs crypto: add symlink encryption This patch implements encryption support for symlink. Signed-off-by: Uday Savagaonkar <savagaon@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit e6422e991e35f6db0de71b1ed56156693c954a38 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed Apr 29 17:02:18 2015 -0700 f2fs crypto: add filename encryption for roll-forward recovery This patch adds a bit flag to indicate whether or not i_name in the inode is encrypted. If this name is encrypted, we can't do recover_dentry during roll-forward. So, f2fs_sync_file() needs to do checkpoint, if this will be needed in future. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 0c2ecd76ef04b9331b3e1af6a84ea610ff88f395 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Apr 27 17:12:39 2015 -0700 f2fs crypto: add filename encryption for f2fs_lookup This patch implements filename encryption support for f2fs_lookup. Note that, f2fs_find_entry should be outside of f2fs_(un)lock_op(). Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 0922ccb6bcc70e5499af179c5409f21bc5f8043e Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Apr 27 16:26:24 2015 -0700 f2fs crypto: add filename encryption for f2fs_readdir This patch implements filename encryption support for f2fs_readdir. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 5db97f6f11bf84975a5af993194729315b9773dd Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Apr 27 14:51:02 2015 -0700 f2fs crypto: add filename encryption for f2fs_add_link This patch adds filename encryption support for f2fs_add_link. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 37982bdc2790b8792ea0ecdd4c4e8134a2e0c57b Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Thu Apr 23 12:04:33 2015 -0700 f2fs crypto: add encryption support in read/write paths This patch adds encryption support in read and write paths. Note that, in f2fs, we need to consider cleaning operation. In cleaning procedure, we must avoid encrypting and decrypting written blocks. So, this patch implements move_encrypted_block(). Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit d1825dd987f1b1271b0de66eac87e4926653fc6d Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Sat May 30 03:55:32 2015 +0300 f2fs crypto: activate encryption support for fs APIs This patch activates the following APIs for encryption support. The rules quoted by ext4 are: - An unencrypted directory may contain encrypted or unencrypted files or directories. - All files or directories in a directory must be protected using the same key as their containing directory. - Encrypted inode for regular file should not have inline_data. - Encrypted symlink and directory may have inline_data and inline_dentry. This patch activates the following APIs. 1. f2fs_link : validate context 2. f2fs_lookup : '' 3. f2fs_rename : '' 4. f2fs_create/f2fs_mkdir : inherit its dir's context 5. f2fs_direct_IO : do buffered io for regular files 6. f2fs_open : check encryption info 7. f2fs_file_mmap : '' 8. f2fs_setattr : '' 9. f2fs_file_write_iter : '' (Called by sys_io_submit) 10. f2fs_fallocate : do not support fcollapse 11. f2fs_evict_inode : free_encryption_info Conflicts: fs/f2fs/data.c Change-Id: I407f8edbb730451cc82186ddbd8a444acc2d5153 Signed-off-by: Michael Halcrow <mhalcrow@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit c9057553829b1e4aec898b147c21fcbbdaf42a81 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Sun Apr 26 00:12:50 2015 -0700 f2fs crypto: filename encryption facilities This patch adds filename encryption infra. Most of codes are copied from ext4 part, but changed to adjust f2fs directory structure. Signed-off-by: Uday Savagaonkar <savagaon@google.com> Signed-off-by: Ildar Muslukhov <ildarm@google.com> Signed-off-by: Michael Halcrow <mhalcrow@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit e4849088ad5692a4e87f5e1944ee8d95553d6af4 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Tue Apr 21 16:23:47 2015 -0700 f2fs crypto: add encryption key management facilities This patch copies from encrypt_key.c in ext4, and modifies for f2fs. Use GFP_NOFS, since _f2fs_get_encryption_info is called under f2fs_lock_op. Signed-off-by: Michael Halcrow <mhalcrow@google.com> Signed-off-by: Ildar Muslukhov <muslukhovi@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 7a6b88d7b76d0ec33a1a9b3b4652a701e04ab8d7 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Apr 20 19:52:47 2015 -0700 f2fs crypto: add f2fs encryption facilities Most of parts were copied from ext4, except: - add f2fs_restore_and_release_control_page which returns control page and restore control page - remove ext4_encrypted_zeroout() - remove sbi->s_file_encryption_mode & sbi->s_dir_encryption_mode - add f2fs_end_io_crypto_work for mpage_end_io Signed-off-by: Michael Halcrow <mhalcrow@google.com> Signed-off-by: Ildar Muslukhov <ildarm@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit e3c6346af07fcac38a55e2bb362df325060dbfa4 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Sat May 30 03:53:02 2015 +0300 f2fs crypto: add encryption policy and password salt support This patch adds encryption policy and password salt support through ioctl implementation. It adds three ioctls: F2FS_IOC_SET_ENCRYPTION_POLICY, F2FS_IOC_GET_ENCRYPTION_POLICY, F2FS_IOC_GET_ENCRYPTION_PWSALT, which use xattr operations. Note that, these definition and codes are taken from ext4 crypto support. For f2fs, xattr operations and on-disk flags for superblock and inode were changed. Conflicts: fs/f2fs/f2fs.h Change-Id: Ie26c1e21bd8d9220a470cfe1cad2decb8ef2740e Signed-off-by: Michael Halcrow <mhalcrow@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Ildar Muslukhov <muslukhovi@gmail.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 9364af8d6fd9d83c276773fd839ec164854d065e Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Fri Apr 10 16:43:31 2015 -0700 f2fs crypto: add encryption xattr support This patch add some definition for enrcyption xattr. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit cfca666a259a7ed2863e4be41f53a71a94e230ed Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Fri Apr 10 16:28:26 2015 -0700 f2fs crypto: add f2fs encryption Kconfig This patch adds f2fs encryption config. This patch integrates: "ext4 crypto: require CONFIG_CRYPTO_CTR if ext4 encryption is enabled On arm64 this is apparently needed for CTS mode to function correctly. Otherwise attempts to use CTS return ENOENT." Signed-off-by: Michael Halcrow <mhalcrow@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit c2f8df83f2fc990fd80e00b6c2df604a9894d092 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Apr 20 13:57:51 2015 -0700 f2fs crypto: declare some definitions for f2fs encryption feature This definitions will be used by inode and superblock for encyption. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit f1b4fdf0ad9546b4db680b58a97f2e3de3b4784a Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Fri May 8 19:30:32 2015 -0700 f2fs: report unwritten area in f2fs_fiemap This patch slightly changes f2fs_fiemap function to report unwritten area. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit e002552aab14ce70781a772c10d2d3f5b20baaec Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Fri May 8 16:37:28 2015 -0700 f2fs: avoid value overflow in showing current status This patch fixes overflow when do cat /sys/kernel/debug/f2fs/status. If a section is relatively large, dist value can be overflowed. Reported-by: Yossi Goldfill <ygoldfill@radianmemory.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 298b7e72abe8fd01162966d2a3278fcfa3091abd Author: Chao Yu <chao2.yu@samsung.com> Date: Wed May 6 13:11:13 2015 +0800 f2fs: support FALLOC_FL_ZERO_RANGE Now, FALLOC_FL_ZERO_RANGE flag in ->fallocate is supported in ext4/xfs. In commit, the semantics of this flag is descripted as following:" 1) Make sure that both offset and len are block size aligned. 2) Update the i_size of inode by len bytes. 3) Compute the file's logical block number against offset. If the computed block number is not the starting block of the extent, split the extent such that the block number is the starting block of the extent. 4) Shift all the extents which are lying between [offset, last allocated extent] towards right by len bytes. This step will make a hole of len bytes at offset." This patch implements fallocate's FALLOC_FL_ZERO_RANGE for f2fs. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 69592cd8daa1027741ac86e498ae9e71c8eccf95 Author: Chao Yu <chao2.yu@samsung.com> Date: Wed May 6 13:09:46 2015 +0800 f2fs: support FALLOC_FL_COLLAPSE_RANGE Now, FALLOC_FL_COLLAPSE_RANGE flag in ->fallocate is supported in ext4/xfs. In commit, the semantics of this flag is descripted as following:" 1) It collapses the range lying between offset and length by removing any data blocks which are present in this range and than updates all the logical offsets of extents beyond "offset + len" to nullify the hole created by removing blocks. In short, it does not leave a hole. 2) It should be used exclusively. No other fallocate flag in combination. 3) Offset and length supplied to fallocate should be fs block size aligned in case of xfs and ext4. 4) Collaspe range does not work beyond i_size." This patch implements fallocate's FALLOC_FL_COLLAPSE_RANGE for f2fs. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 1c615b44cea0f68a8880cfdef1d8fdc6c3412249 Author: Chao Yu <chao2.yu@samsung.com> Date: Wed May 6 13:08:06 2015 +0800 f2fs: introduce f2fs_replace_block() for reuse Introduce a generic function replace_block base on recover_data_page, and export it. So with it we can operate file's meta data which is in CP/SSA area when we invoke fallocate with FALLOC_FL_COLLAPSE_RANGE flag. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 668cd2607b7ab0a4fc94563d2bfcd3e2460827bb Author: Chao Yu <chao2.yu@samsung.com> Date: Thu Apr 30 18:35:50 2015 +0800 f2fs: do not re-lookup nat cache with same nid In set_node_addr, we try to lookup cached nat entry of inode and then set flag in it. But previously in this function, we have already grabbed nat entry with current node id, if the node id is the same as the one of inode, we do not need to lookup it in cache again. So this patch adds condition judgment for reducing unneeded lookup. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 9a5b896f752fc26046f4c5cc9390fcfa5e9044ee Author: Chao Yu <chao2.yu@samsung.com> Date: Thu Apr 30 18:34:41 2015 +0800 f2fs: remove unneeded f2fs_make_empty declaration Remove f2fs_make_empty() declaration, since the main body of this function is move into do_make_empty_dir() and the function is obsolete now. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 91a71eae9377fdcddfd526dad85c7868bb17863f Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Thu Apr 30 22:50:06 2015 -0700 f2fs: issue discard with finally produced len and minlen This patch determines to issue discard commands by comparing given minlen and the length of produced final candidates. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 74a0bd91eb27bc6bf8b7d5b4d0576ec9ceaa31ad Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Thu Apr 30 22:37:50 2015 -0700 f2fs: introduce discard_map for f2fs_trim_fs This patch adds a bitmap for discard issues from f2fs_trim_fs. There-in rule is to issue discard commands only for invalidated blocks after mount. Once mount is done, f2fs_trim_fs trims out whole invalid area. After ehn, it will not issue and discrads redundantly. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit c61181f0e958976a2d4a37dca015419dde22ddc0 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Fri May 1 11:08:59 2015 -0700 f2fs: revmove spin_lock for write_orphan_inodes This patch removes spin_lock, since this is covered by f2fs_lock_op already. And, we should avoid to use page operations inside spin_lock. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 5afc4d50c96103050a35d1cea5e87dbc09ae10f8 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Thu Apr 30 17:00:33 2015 -0700 f2fs: split find_data_page according to specific purposes This patch splits find_data_page as follows. 1. f2fs_gc - use get_read_data_page() with read only 2. find_in_level - use find_data_page without locked page 3. truncate_partial_page - In the case cache_only mode, just drop cached page. - Ohterwise, use get_lock_data_page() and guarantee to truncate Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 87aafb380f1996e4c52598a3efd91d920bcfa7f9 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Thu Apr 30 18:58:22 2015 -0700 f2fs: fix counting the number of inline_data inodes This patch fixes to count the missing symlink case. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit ffef9b60036ca4538b55a701fe04191b636217ef Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed Apr 29 18:31:19 2015 -0700 f2fs: add need_dentry_mark This patch introduces need_dentry_mark() to clean up and avoid redundant node locks. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit ba47ac654a4c59152f1ce6db8fd05e9383dec1fe Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed Apr 29 11:18:42 2015 -0700 f2fs: fix race on allocating and deallocating a dentry block There are two threads: f2fs_delete_entry() get_new_data_page() f2fs_reserve_block() dn.blkaddr = XXX lock_page(dentry_block) truncate_hole() dn.blkaddr = NULL unlock_page(dentry_block) lock_page(dentry_block) fill the block from XXX address add new dentries unlock_page(dentry_block) Later, f2fs_write_data_page() will truncate the dentry_block, since its block address is NULL. The reason for this was due to the wrong lock order. In this case, we should do f2fs_reserve_block() after locking its dentry block. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit a42b0a273a344637eb5f5471e5d28ac7dda7e8e9 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Sun Apr 26 00:15:29 2015 -0700 f2fs: introduce dot and dotdot name check This patch adds an inline function to check dot and dotdot names. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 18c184303ab9d3c678e995b5bf7ca5342fbbf6a4 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Fri Apr 24 14:34:30 2015 -0700 f2fs: move get_page for gc victims This patch moves getting victim page into move_data_page. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit b2f7597deea395e7f7d1cd3be8611f32e1e3efaa Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Thu Apr 23 14:38:15 2015 -0700 f2fs: add sbi and page pointer in f2fs_io_info This patch adds f2fs_sb_info and page pointers in f2fs_io_info structure. With this change, we can reduce a lot of parameters for IO functions. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit d8e89b536fda0e5cfefe39ce08da6f9e0dbe0ebb Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Thu Apr 23 10:27:21 2015 -0700 f2fs: add f2fs_may_inline_{data, dentry} This patch adds f2fs_may_inline_data and f2fs_may_inline_dentry. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit cb883ba942a6ed6d456336fe564c4b44e6198c0d Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed Apr 22 11:40:27 2015 -0700 f2fs: clean up f2fs_lookup This patch cleans up to avoid deep indentation. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 01a04b4c504ca53b225f4c5d790fd4401be51093 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Sat May 30 03:51:08 2015 +0300 f2fs: expose f2fs_mpage_readpages This patch implements f2fs_mpage_readpages for further optimization on encryption support. The basic code was taken from fs/mpage.c, and changed to be simple by adjusting that block_size is equal to page_size in f2fs. Conflicts: fs/f2fs/data.c Change-Id: Id413493a8fe6c7f6e69093127f8c6e9a7a8ba89d Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 8b2b31668d8f0b71f8b2e6dd9e569aa4f2839802 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Apr 20 18:49:51 2015 -0700 f2fs: introduce f2fs_commit_super This patch introduces f2fs_commit_super to write updated superblock. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit d6c2b7a44a3b04d55d19c15a1d9715262dc5f9ca Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Apr 6 19:55:34 2015 -0700 f2fs: add f2fs_map_blocks This patch introduces f2fs_map_blocks structure likewise ext4_map_blocks. Now, f2fs uses f2fs_map_blocks when handling get_block. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit d7059701be7fdeeeedf4cad7421215304893ec77 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Apr 13 15:10:36 2015 -0700 f2fs: add feature facility in superblock This patch introduces a feature in superblock, which will indicate any new features for f2fs. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 0f7e2640a2dcbb9518db29f7f11efa4bbcb4da68 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Apr 20 11:52:23 2015 -0700 f2fs: add missing version info in superblock The mkfs.f2fs remains kernel version in superblock, but f2fs module has not added that so far. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit eac4ad9a9caf2487ac4c3f52b2bbbda78aa6abd9 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Apr 20 13:44:41 2015 -0700 f2fs: move existing definitions into f2fs.h This patch moves some inode-related definitions from node.h to f2fs.h to add new features. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 631726792831934a9bc52b80774041154a9606c7 Author: Chao Yu <chao2.yu@samsung.com> Date: Sat Apr 18 18:06:49 2015 +0800 f2fs: make has_fsynced_inode static has_fsynced_inode() has no other caller out of node.c, make it static. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 5f32f11835a35945f51a4d167ea7584454c0f8de Author: Taehee Yoo <ap420073@gmail.com> Date: Tue Apr 21 15:59:12 2015 +0900 f2fs: add offset check routine before punch_hole() in f2fs_fallocate() In the punch_hole(), if offset bigger than inode size, it returns SUCCESS. Then f2fs_fallocate() will update time and dirty mark. In that case, inode has not been modified actually. So I have added offset check routine that prevent to call the punch_hole(). Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 540a536766de5ff64402bdb6efc53552d6fe0313 Author: Chao Yu <chao2.yu@samsung.com> Date: Sat Apr 18 18:05:36 2015 +0800 f2fs: use is_valid_blkaddr to verify blkaddr for readability Export is_valid_blkaddr() and use it to replace some codes for readability. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit d8972539d263574eef3555446dd79b9255d1585a Author: Chao Yu <chao2.yu@samsung.com> Date: Sat Apr 18 18:03:58 2015 +0800 f2fs: make posix_acl_create() safer and cleaner Our f2fs_acl_create is copied from posix_acl_create in ./fs/posix_acl.c and modified to avoid deadlock bug when inline_dentry feature is enabled. Dan Carpenter rewrites posix_acl_create in commit 2799563b281f ("fs/posix_acl.c: make posix_acl_create() safer and cleaner") to make this function more safer, so that we can avoid potential bug in its caller, especially for ocfs2. Let's back port the patch to f2fs. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit a9cf8749358973f83ff535d1958b067f8ad0e807 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed Apr 22 11:03:48 2015 -0700 f2fs: fix wrong error hanlder in f2fs_follow_link The page_follow_link_light returns NULL and its error pointer was remained in nd->path. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit ee92d4b167e63cb6f0fba74a6ada00863057cb67 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Tue Apr 21 10:40:54 2015 -0700 Revert "f2fs: enhance multi-threads performance" This reports performance regression by Yuanhan Liu. The basic idea was to reduce one-point mutex, but it turns out this causes another contention like context swithes. https://lkml.org/lkml/2015/4/21/11 Until finishing the analysis on this issue, I'd like to revert this for a while. This reverts commit 78373b7319abdf15050af5b1632c4c8b8b398f33. commit 7883504e5d988e192ee57e695da9448d821f50e2 Author: doc <doc.divxm@gmail.com> Date: Sat May 30 10:58:40 2015 +0300 Revert "f2fs: support 3.10" This reverts commit 89b2b2ae32d324f0dfc0b8898798969134fd5b84. Change-Id: I73f831eea4b616c07413c8f3f3f3bac4111c801c commit c3fab7fea7fea818a1f0af2493d827dd8c1dfb2e Author: Jaegeuk Kim <jaegeuk.kim@samsung.com> Date: Tue Feb 4 14:20:16 2014 +0900 f2fs: support 3.10 Change-Id: I9059ac5ed39e25b31be078399452d9625506b780 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 39520b54dab76f5d79248b9ff7584934fb04b2bd Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Thu Apr 9 17:03:53 2015 -0700 f2fs: pass checkpoint reason on roll-forward recovery This patch adds CP_RECOVERY to remain recovery information for checkpoint. And, it makes sure writing checkpoint in this case. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 783f95a08679ffbd1e5ae04db571cebfa3b5108d Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed Apr 15 13:49:55 2015 -0700 f2fs: avoid abnormal behavior on broken symlink When f2fs_symlink was triggered and checkpoint was done before syncing its link path, f2fs can get broken symlink like "xxx -> \0\0\0". This incurs abnormal path_walk by VFS. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 2d428db306541ce5c1b3cb84854df35637b15cc3 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed Apr 15 13:37:53 2015 -0700 f2fs: flush symlink path to avoid broken symlink after POR This patch tries to avoid broken symlink case after POR in best effort. This results in performance regression. But, if f2fs has inline_data and the target path is under 3KB-sized long, the page would be stored in its inode_block, so that there would be no performance regression. Note that, if user wants to keep this file atomically, it needs to trigger dir->fsync. And, there is still a hole to produce broken symlink. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit e5ad0b9633c463b93cee9987f6244caa0b8e653a Author: Taehee Yoo <ap420073@gmail.com> Date: Mon Apr 13 21:48:06 2015 +0900 f2fs: change 0 to false for bool type in the f2fs_fill_super function, variable "retry" is bool type i think that it should be set as false. Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 9484926fdc3cba35d52e67c37136c84cc6a3d936 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed Apr 1 19:38:20 2015 -0700 f2fs: do not recover wrong data index During the roll-forward recovery, if we found a new data index written fsync lastly, we need to recover new block address. But, if that address was corrupted, we should not recover that. Otherwise, f2fs gets kernel panic from: In check_index_in_prev_nodes(), sentry = get_seg_entry(sbi, segno); --------------------------> out-of-range segno. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 02dba4ef5e99c6f724e20b6449b64c98ba3a7ed4 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Tue Mar 31 18:03:29 2015 -0700 f2fs: do not increase link count during recovery If there are multiple fsynced dnodes having a dent flag, roll-forward routine sets FI_INC_LINK for their inode, and recovery_dentry increases its link count accordingly. That results in normal file having a link count as 2, so we can't unlink those files. This was added to handle several inode blocks having same inode number with different directory paths. But, current f2fs doesn't replay all of path changes and only recover its dentry for the last fsynced inode block. So, there is no reason to do this. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit e5bae38d60d93e40dee266a3198be4b1e4337215 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Mar 30 15:23:45 2015 -0700 f2fs: assign parent's i_mode for empty dir When assigning i_mode for dotdot, it needs to assign parent's i_mode. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 945df7d6bd0c818e81da1f583fcb6d8bbe217ed4 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Mar 30 15:07:16 2015 -0700 f2fs: add F2FS_INLINE_DOTS to recover missing dot dentries If f2fs was corrupted with missing dot dentries, it needs to recover them after fsck.f2fs detection. The underlying precedure is: 1. The fsck.f2fs remains F2FS_INLINE_DOTS flag in directory inode, if it detects missing dot dentries. 2. When f2fs looks up the corrupted directory, it triggers f2fs_add_link with proper inode numbers and their dot and dotdot names. 3. Once f2fs recovers the directory without errors, it removes F2FS_INLINE_DOTS finally. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit feb625fb93d4251aa16a23ccabdd827b223733cb Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Thu Mar 26 18:46:38 2015 -0700 f2fs: fix mismatching lock and unlock pages for roll-forward recovery Previously, inode page is not correctly locked and unlocked in pair during the roll-forward recovery. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit f87dbe5bf4010a3ac30da36b837380d2f78262e0 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Tue Mar 24 12:04:20 2015 -0700 f2fs: fix sparse warnings This patch fixes the below warning. sparse warnings: (new ones prefixed by >>) >> fs/f2fs/inode.c:56:23: sparse: restricted __le32 degrades to integer >> fs/f2fs/inode.c:56:52: sparse: restricted __le32 degrades to integer Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 55872dc313a783379de2385454bf7f4cd1f44fff Author: Chao Yu <chao2.yu@samsung.com> Date: Tue Mar 24 13:08:05 2015 +0800 f2fs: limit b_size of mapped bh in f2fs_map_bh Map bh over max size which caller defined is not needed, limit it in f2fs_map_bh. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 252d8d969f381ff097c746d402523835a30b5418 Author: Chao Yu <chao2.yu@samsung.com> Date: Mon Mar 23 10:37:39 2015 +0800 f2fs: persist system.advise into on-disk inode This patch fixes to dirty inode for persisting i_advise of f2fs inode info into on-disk inode if user sets system.advise through setxattr. Otherwise the new value will be lost. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit ddb5c14b13a9de1196b382d75a103a9cfd4c575e Author: Chao Yu <chao2.yu@samsung.com> Date: Mon Mar 23 10:36:15 2015 +0800 f2fs: avoid NULL pointer dereference in f2fs_xattr_advise_get We will encounter oops by executing below command. getfattr -n system.advise /mnt/f2fs/file Killed message log: BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<f8b54d69>] f2fs_xattr_advise_get+0x29/0x40 [f2fs] *pdpt = 00000000319b7001 *pde = 0000000000000000 Oops: 0002 [#1] SMP Modules linked in: f2fs(O) snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq joydev snd_seq_device snd_timer bnep snd rfcomm microcode bluetooth soundcore i2c_piix4 mac_hid serio_raw parport_pc ppdev lp parport binfmt_misc hid_generic psmouse usbhid hid e1000 [last unloaded: f2fs] CPU: 3 PID: 3134 Comm: getfattr Tainted: G O 4.0.0-rc1 #6 Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 task: f3a71b60 ti: f19a6000 task.ti: f19a6000 EIP: 0060:[<f8b54d69>] EFLAGS: 00010246 CPU: 3 EIP is at f2fs_xattr_advise_get+0x29/0x40 [f2fs] EAX: 00000000 EBX: f19a7e71 ECX: 00000000 EDX: f8b5b467 ESI: 00000000 EDI: f2008570 EBP: f19a7e14 ESP: f19a7e08 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 CR0: 80050033 CR2: 00000000 CR3: 319b8000 CR4: 000007f0 Stack: f8b5a634 c0cbb580 00000000 f19a7e34 c1193850 00000000 00000007 f19a7e71 f19a7e64 c0cbb580 c1193810 f19a7e50 c1193c00 00000000 00000000 00000000 c0cbb580 00000000 f19a7f70 c1194097 00000000 00000000 00000000 74737973 Call Trace: [<c1193850>] generic_getxattr+0x40/0x50 [<c1193810>] ? xattr_resolve_name+0x80/0x80 [<c1193c00>] vfs_getxattr+0x70/0xa0 [<c1194097>] getxattr+0x87/0x190 [<c11801d7>] ? path_lookupat+0x57/0x5f0 [<c11819d2>] ? putname+0x32/0x50 [<c116653a>] ? kmem_cache_alloc+0x2a/0x130 [<c11819d2>] ? putname+0x32/0x50 [<c11819d2>] ? putname+0x32/0x50 [<c11819d2>] ? putname+0x32/0x50 [<c11827f9>] ? user_path_at_empty+0x49/0x70 [<c118283f>] ? user_path_at+0x1f/0x30 [<c11941e7>] path_getxattr+0x47/0x80 [<c11948e7>] SyS_getxattr+0x27/0x30 [<c163f748>] sysenter_do_call+0x12/0x12 Code: 66 90 55 89 e5 57 56 53 66 66 66 66 90 8b 78 20 89 d3 ba 67 b4 b5 f8 89 d8 89 ce e8 42 7c 7b c8 85 c0 75 16 0f b6 87 44 01 00 00 <88> 06 b8 01 00 00 00 5b 5e 5f 5d c3 8d 76 00 b8 ea ff ff ff eb EIP: [<f8b54d69>] f2fs_xattr_advise_get+0x29/0x40 [f2fs] SS:ESP 0068:f19a7e08 CR2: 0000000000000000 ---[ end trace 860260654f1f416a ]--- The reason is that in getfattr there are two steps which is indicated by strace info: 1) try to lookup and get size of specified xattr. 2) get value of the extented attribute. strace info: getxattr("/mnt/f2fs/file", "system.advise", 0x0, 0) = 1 getxattr("/mnt/f2fs/file", "system.advise", "\x00", 256) = 1 For the first step, getfattr may pass a NULL pointer in @value and zero in @size as parameters for ->getxattr, but we access this @value pointer directly without checking whether the pointer is valid or not in f2fs_xattr_advise_get, so the oops occurs. This patch fixes this issue by verifying @value pointer before using. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit b0b3d399c9c7d01a052bb1643c6727bb0380850e Author: Chao Yu <chao2.yu@samsung.com> Date: Mon Mar 23 10:33:37 2015 +0800 f2fs: preallocate fallocated blocks for direct IO Normally, due to DIO_SKIP_HOLES flag is set by default, blockdev_direct_IO in f2fs_direct_IO tries to skip DIO in holes when writing inside i_size, this makes us falling back to buffered IO which shows lower performance. So in commit 59b802e5a453 ("f2fs: allocate data blocks in advance for f2fs_direct_IO"), we improve perfromance by allocating data blocks in advance if we meet holes no matter in i_size or not, since with it we can avoid falling back to buffered IO. But we forget to consider for unwritten fallocated block in this commit. This patch tries to fix it for fallocate case, this helps to improve performance. Test result: Storage info: sandisk ultra 64G micro sd card. touch /mnt/f2fs/file truncate -s 67108864 /mnt/f2fs/file fallocate -o 0 -l 67108864 /mnt/f2fs/file time dd if=/dev/zero of=/mnt/f2fs/file bs=1M count=64 conv=notrunc oflag=direct Time before applying the patch: 67108864 bytes (67 MB) copied, 36.16 s, 1.9 MB/s real 0m36.162s user 0m0.000s sys 0m0.180s Time after applying the patch: 67108864 bytes (67 MB) copied, 27.7776 s, 2.4 MB/s real 0m27.780s user 0m0.000s sys 0m0.036s Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 5b2ffbe519dddc8205a615a97943c978906262eb Author: Wanpeng Li <wanpeng.li@linux.intel.com> Date: Tue Mar 24 10:20:27 2015 +0800 f2fs: enable inline data by default Enable inline_data feature by default since it brings us better performance and space utilization and now has already stable. Add another option noinline_data to disable it during mount. Suggested-by: Jaegeuk Kim <jaegeuk@kernel.org> Suggested-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 5b6c1edfe66a6429acb9d5216aafb340022709bd Author: Chao Yu <chao2.yu@samsung.com> Date: Thu Mar 19 19:27:51 2015 +0800 f2fs: preserve extent info for extent cache This patch tries to preserve last extent info in extent tree cache into on-disk inode, so this can help us to reuse the last extent info next time for performance. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit ef0c384c2b9eeb740ba676a10e5a2b194b23b1b0 Author: Chao Yu <chao2.yu@samsung.com> Date: Thu Mar 19 19:26:02 2015 +0800 f2fs: initialize extent tree with on-disk extent info of inode With normal extent info cache, we records largest extent mapping between logical block and physical block into extent info, and we persist extent info in on-disk inode. When we enable extent tree cache, if extent info of on-disk inode is exist, and the extent is not a small fragmented mapping extent. We'd better to load the extent info into extent tree cache when inode is loaded. By this way we can have more chance to hit extent tree cache rather than taking more time to read dnode page for block address. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 49b71c3af3ee7476f647071eee659998f11678d1 Author: Chao Yu <chao2.yu@samsung.com> Date: Thu Mar 19 19:24:59 2015 +0800 f2fs: introduce __{find,grab}_extent_tree This patch introduces __{find,grab}_extent_tree for reusing by following patches. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 841e0eccff53960fc7dcfec4a9f1e09186478205 Author: Chao Yu <chao2.yu@samsung.com> Date: Thu Mar 19 19:23:32 2015 +0800 f2fs: split set_data_blkaddr from f2fs_update_extent_cache Split __set_data_blkaddr from f2fs_update_extent_cache for readability. Additionally rename __set_data_blkaddr to set_data_blkaddr for exporting. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit f0683a2560052529e3b64180f54f2289463d8d82 Author: Wanpeng Li <wanpeng.li@linux.intel.com> Date: Thu Mar 19 13:23:48 2015 +0800 f2fs: enable fast symlink by utilizing inline data Fast symlink can utilize inline data flow to avoid using any i_addr region, since we need to handle many cases such as truncation, roll-forward recovery, and fsck/dump tools. Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 139dd93c93898c3ccf19791d29890fe594332d64 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Tue Mar 17 17:58:08 2015 -0700 f2fs: add some tracepoints to debug volatile and atomic writes Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 94718185df166d6c87cf856375479ee2c296be2b Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Tue Mar 17 17:16:35 2015 -0700 f2fs: avoid punch_hole overhead when releasing volatile data This patch is to avoid some punch_hole overhead when releasing volatile data. If volatile data was not written yet, we just can make the first page as zero. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 3e8a62b8c2858369f7d563525fb528f7a4f1cb30 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Mon Mar 16 16:54:52 2015 -0700 f2fs: avoid wrong f2fs_bug_on when truncating inline_data This patch removes wrong f2fs_bug_on in truncate_inline_inode. When there is no space, it can happen a corner case where i_isze is over MAX_INLINE_SIZE while its inode is still inline_data. The scenario is 1. write small data into file #A. 2. fill the whole partition to 100%. 3. truncate 4096 on file #A. 4. write data at 8192 offset. --> f2fs_write_begin -> -ENOSPC = f2fs_convert_inline_page -> f2fs_write_failed -> truncate_blocks -> truncate_inline_inode BUG_ON, since i_size is 4096. Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 91c955cae47d1e00bf6b8db945f603df00b9feac Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Fri Mar 13 21:44:36 2015 -0700 f2fs: enhance multi-threads performance Previously, f2fs_write_data_pages has a mutex, sbi->writepages, to serialize data writes to maximize write bandwidth, while sacrificing multi-threads performance. Practically, however, multi-threads environment is much more important for users. So this patch tries to remove the mutex. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 4c02c4dac27ed95f8397c32ecce4a822f531d9f2 Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed Mar 11 23:27:25 2015 -0400 f2fs: set buffer_new when new blocks are allocated This patch modifies to call set_buffer_new, if new blocks are allocated. Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 6a69e9c5bfef161547fe3efdcf0894faeb45e37b Author: Chao Yu <chao2.yu@samsung.com> Date: Mon Mar 16 21:08:44 2015 +0800 f2fs: set SBI_NEED_FSCK when encountering exception in recovery This patch tries to set SBI_NEED_FSCK flag into sbi only when we fail to recover in fill_super, so we could skip fscking image when we fail to fill super for other reason. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 8c91980616b9af9cfeb810d1a7c82ad9323b3e7d Author: Jaegeuk Kim <jaegeuk@kernel.org> Date: Wed Mar 11 13:42:48 2015 -0400 f2fs: fix to cover sentry_lock for block allocation In the following call stack, f2fs changes the bitmap for dirty segments and # of dirty sentries without grabbing sit_i->sentry_lock. This can result in mismatch on bitmap and # of dirty sentries, since if there are some direct_io operations. In allocate_data_block, - __allocate_new_segments - mutex_lock(&curseg->curseg_mutex); - s_ops->allocate_segment - new_curseg/change_curseg - reset_curseg - __set_sit_entry_type - __mark_sit_entry_dirty - set_bit(dirty_sentries_bitmap) - dirty_sentries++; Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 8189fdf992151e8826c924241674ef0de44fde40 Author: Chao Yu <chao2.yu@samsung.com> Date: Thu Mar 12 17:04:24 2015 +0800 f2fs: fix to check current blkaddr in __allocate_data_blocks In __allocate_data_blocks, we should check current blkaddr which is located at ofs_in_node of dnode page instead of checking first blkaddr all the time. Otherwise we can only allocate one blkaddr in each dnode page. Fix it. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit d616037f0c30568df61b77c738a4f6dfdde4b20b Author: Chao Yu <chao2.yu@samsung.com> Date: Tue Mar 10 13:16:25 2015 +0800 f2fs: fix to truncate inline data past EOF Previously if inode is with inline data, we will try to invalid partial inline data in page #0 when we truncate size of inode in truncate_partial_data_page(). And then we set page #0 to dirty, after this we can synchronize inode page with page #0 at ->writepage(). But sometimes we will fail to operate page #0 in truncate_partial_data_page() due to below reason: a) if offset is zero, we will skip setting page #0 to dirty. b) if page #0 is not uptodate, we will fail to update it as it has no mapping data. So with following operations, we will meet recent data which should be truncated. 1.write inline data to file 2.sync first data page to inode page 3.truncate file size to 0 4.truncate file size to max_inline_size 5.echo 1 > /proc/sys/vm/drop_caches 6.read file --> meet original inline data which is remained in inode page. This patch renames truncate_inline_data() to truncate_inline_inode() for code readability, then use truncate_inline_inode() to truncate inline data in inode page in truncate_blocks() and truncate page #0 in truncate_partial_data_page() for fixing. v2: o truncate partially #0 page in truncate_partial_data_page to avoid keeping old data in #0 page. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit 74707d08913a157106af3dcacfce3be4f67f2c54 Author: Chao Yu <chao2.yu@samsung.com> Date: Mon Mar 9 18:18:19 2015 +0800 f2fs: fix reference leaks in f2fs_acl_create Our f2fs_acl_create is copied and modified from posix_acl_create to avoid deadlock bug when inline_dentry feature is enabled. Now, we got reference leaks in posix_acl_create, and this has been fixed in commit fed0b588be2f ("posix_acl: fix reference leaks in posix_acl_create") by Omar Sandoval. https://lkml.org/lkml/2015/2/9/5 Let's fix this issue in f2fs_acl_create too. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Reviewed-by: Changman Lee <cm224.lee@ssamsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> commit c8539703ed9549d476a7ea4134e83a26104e309d Author: Chao Yu <chao2.yu@samsung.com> Date: Mon Mar 9 17:33:16 2015 +0800 f2fs: fix to calculate max length of contiguous free slots correctly When l…
- Loading branch information