aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-06-24 23:38:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-24 23:38:29 -0400
commitcfcc0ad47f4cbc19ddd057cfb39b144a3518c59e (patch)
tree35a752e715d42b30eb594b5e2d5ffcc004cddbee
parenta7296b49fb40525a5c42f650617749def3d25bcc (diff)
parent3c45414527487549f469484337a4c5ae5d84dc80 (diff)
Merge tag 'for-f2fs-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs
Pull f2fs updates from Jaegeuk Kim: "New features: - per-file encryption (e.g., ext4) - FALLOC_FL_ZERO_RANGE - FALLOC_FL_COLLAPSE_RANGE - RENAME_WHITEOUT Major enhancement/fixes: - recovery broken superblocks - enhance f2fs_trim_fs with a discard_map - fix a race condition on dentry block allocation - fix a deadlock during summary operation - fix a missing fiemap result .. and many minor bug fixes and clean-ups were done" * tag 'for-f2fs-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (83 commits) f2fs: do not trim preallocated blocks when truncating after i_size f2fs crypto: add alloc_bounce_page f2fs crypto: fix to handle errors likewise ext4 f2fs: drop the volatile_write flag only f2fs: skip committing valid superblock f2fs: setting discard option in parse_options() f2fs: fix to return exact trimmed size f2fs: support FALLOC_FL_INSERT_RANGE f2fs: hide common code in f2fs_replace_block f2fs: disable the discard option when device doesn't support f2fs crypto: remove alloc_page for bounce_page f2fs: fix a deadlock for summary page lock vs. sentry_lock f2fs crypto: clean up error handling in f2fs_fname_setup_filename f2fs crypto: avoid f2fs_inherit_context for symlink f2fs crypto: do not set encryption policy for non-directory by ioctl f2fs crypto: allow setting encryption policy once f2fs crypto: check context consistent for rename2 f2fs: avoid duplicated code by reusing f2fs_read_end_io f2fs crypto: use per-inode tfm structure f2fs: recovering broken superblock during mount ...
-rw-r--r--fs/f2fs/Kconfig19
-rw-r--r--fs/f2fs/Makefile2
-rw-r--r--fs/f2fs/acl.c46
-rw-r--r--fs/f2fs/checkpoint.c56
-rw-r--r--fs/f2fs/crypto.c491
-rw-r--r--fs/f2fs/crypto_fname.c440
-rw-r--r--fs/f2fs/crypto_key.c255
-rw-r--r--fs/f2fs/crypto_policy.c209
-rw-r--r--fs/f2fs/data.c593
-rw-r--r--fs/f2fs/debug.c11
-rw-r--r--fs/f2fs/dir.c194
-rw-r--r--fs/f2fs/f2fs.h320
-rw-r--r--fs/f2fs/f2fs_crypto.h151
-rw-r--r--fs/f2fs/file.c516
-rw-r--r--fs/f2fs/gc.c115
-rw-r--r--fs/f2fs/hash.c3
-rw-r--r--fs/f2fs/inline.c43
-rw-r--r--fs/f2fs/inode.c9
-rw-r--r--fs/f2fs/namei.c374
-rw-r--r--fs/f2fs/node.c48
-rw-r--r--fs/f2fs/node.h22
-rw-r--r--fs/f2fs/recovery.c28
-rw-r--r--fs/f2fs/segment.c250
-rw-r--r--fs/f2fs/segment.h1
-rw-r--r--fs/f2fs/super.c178
-rw-r--r--fs/f2fs/trace.c6
-rw-r--r--fs/f2fs/trace.h4
-rw-r--r--fs/f2fs/xattr.c3
-rw-r--r--fs/f2fs/xattr.h4
-rw-r--r--include/linux/f2fs_fs.h8
-rw-r--r--include/trace/events/f2fs.h33
31 files changed, 3802 insertions, 630 deletions
diff --git a/fs/f2fs/Kconfig b/fs/f2fs/Kconfig
index 05f0f663f14c..c629762005bc 100644
--- a/fs/f2fs/Kconfig
+++ b/fs/f2fs/Kconfig
@@ -72,6 +72,25 @@ config F2FS_CHECK_FS
72 72
73 If you want to improve the performance, say N. 73 If you want to improve the performance, say N.
74 74
75config F2FS_FS_ENCRYPTION
76 bool "F2FS Encryption"
77 depends on F2FS_FS
78 depends on F2FS_FS_XATTR
79 select CRYPTO_AES
80 select CRYPTO_CBC
81 select CRYPTO_ECB
82 select CRYPTO_XTS
83 select CRYPTO_CTS
84 select CRYPTO_CTR
85 select CRYPTO_SHA256
86 select KEYS
87 select ENCRYPTED_KEYS
88 help
89 Enable encryption of f2fs files and directories. This
90 feature is similar to ecryptfs, but it is more memory
91 efficient since it avoids caching the encrypted and
92 decrypted pages in the page cache.
93
75config F2FS_IO_TRACE 94config F2FS_IO_TRACE
76 bool "F2FS IO tracer" 95 bool "F2FS IO tracer"
77 depends on F2FS_FS 96 depends on F2FS_FS
diff --git a/fs/f2fs/Makefile b/fs/f2fs/Makefile
index d92397731db8..396be1a39e55 100644
--- a/fs/f2fs/Makefile
+++ b/fs/f2fs/Makefile
@@ -6,3 +6,5 @@ f2fs-$(CONFIG_F2FS_STAT_FS) += debug.o
6f2fs-$(CONFIG_F2FS_FS_XATTR) += xattr.o 6f2fs-$(CONFIG_F2FS_FS_XATTR) += xattr.o
7f2fs-$(CONFIG_F2FS_FS_POSIX_ACL) += acl.o 7f2fs-$(CONFIG_F2FS_FS_POSIX_ACL) += acl.o
8f2fs-$(CONFIG_F2FS_IO_TRACE) += trace.o 8f2fs-$(CONFIG_F2FS_IO_TRACE) += trace.o
9f2fs-$(CONFIG_F2FS_FS_ENCRYPTION) += crypto_policy.o crypto.o \
10 crypto_key.o crypto_fname.o
diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
index 4320ffab3495..c8f25f7241f0 100644
--- a/fs/f2fs/acl.c
+++ b/fs/f2fs/acl.c
@@ -334,51 +334,45 @@ static int f2fs_acl_create(struct inode *dir, umode_t *mode,
334 struct page *dpage) 334 struct page *dpage)
335{ 335{
336 struct posix_acl *p; 336 struct posix_acl *p;
337 struct posix_acl *clone;
337 int ret; 338 int ret;
338 339
340 *acl = NULL;
341 *default_acl = NULL;
342
339 if (S_ISLNK(*mode) || !IS_POSIXACL(dir)) 343 if (S_ISLNK(*mode) || !IS_POSIXACL(dir))
340 goto no_acl; 344 return 0;
341 345
342 p = __f2fs_get_acl(dir, ACL_TYPE_DEFAULT, dpage); 346 p = __f2fs_get_acl(dir, ACL_TYPE_DEFAULT, dpage);
343 if (IS_ERR(p)) { 347 if (!p || p == ERR_PTR(-EOPNOTSUPP)) {
344 if (p == ERR_PTR(-EOPNOTSUPP)) 348 *mode &= ~current_umask();
345 goto apply_umask; 349 return 0;
346 return PTR_ERR(p);
347 } 350 }
351 if (IS_ERR(p))
352 return PTR_ERR(p);
348 353
349 if (!p) 354 clone = f2fs_acl_clone(p, GFP_NOFS);
350 goto apply_umask; 355 if (!clone)
351
352 *acl = f2fs_acl_clone(p, GFP_NOFS);
353 if (!*acl)
354 goto no_mem; 356 goto no_mem;
355 357
356 ret = f2fs_acl_create_masq(*acl, mode); 358 ret = f2fs_acl_create_masq(clone, mode);
357 if (ret < 0) 359 if (ret < 0)
358 goto no_mem_clone; 360 goto no_mem_clone;
359 361
360 if (ret == 0) { 362 if (ret == 0)
361 posix_acl_release(*acl); 363 posix_acl_release(clone);
362 *acl = NULL; 364 else
363 } 365 *acl = clone;
364 366
365 if (!S_ISDIR(*mode)) { 367 if (!S_ISDIR(*mode))
366 posix_acl_release(p); 368 posix_acl_release(p);
367 *default_acl = NULL; 369 else
368 } else {
369 *default_acl = p; 370 *default_acl = p;
370 }
371 return 0;
372 371
373apply_umask:
374 *mode &= ~current_umask();
375no_acl:
376 *default_acl = NULL;
377 *acl = NULL;
378 return 0; 372 return 0;
379 373
380no_mem_clone: 374no_mem_clone:
381 posix_acl_release(*acl); 375 posix_acl_release(clone);
382no_mem: 376no_mem:
383 posix_acl_release(p); 377 posix_acl_release(p);
384 return -ENOMEM; 378 return -ENOMEM;
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index a5e17a2a0781..b70bbe1a6a8c 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -52,9 +52,11 @@ struct page *get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)
52 struct address_space *mapping = META_MAPPING(sbi); 52 struct address_space *mapping = META_MAPPING(sbi);
53 struct page *page; 53 struct page *page;
54 struct f2fs_io_info fio = { 54 struct f2fs_io_info fio = {
55 .sbi = sbi,
55 .type = META, 56 .type = META,
56 .rw = READ_SYNC | REQ_META | REQ_PRIO, 57 .rw = READ_SYNC | REQ_META | REQ_PRIO,
57 .blk_addr = index, 58 .blk_addr = index,
59 .encrypted_page = NULL,
58 }; 60 };
59repeat: 61repeat:
60 page = grab_cache_page(mapping, index); 62 page = grab_cache_page(mapping, index);
@@ -65,7 +67,9 @@ repeat:
65 if (PageUptodate(page)) 67 if (PageUptodate(page))
66 goto out; 68 goto out;
67 69
68 if (f2fs_submit_page_bio(sbi, page, &fio)) 70 fio.page = page;
71
72 if (f2fs_submit_page_bio(&fio))
69 goto repeat; 73 goto repeat;
70 74
71 lock_page(page); 75 lock_page(page);
@@ -77,8 +81,7 @@ out:
77 return page; 81 return page;
78} 82}
79 83
80static inline bool is_valid_blkaddr(struct f2fs_sb_info *sbi, 84bool is_valid_blkaddr(struct f2fs_sb_info *sbi, block_t blkaddr, int type)
81 block_t blkaddr, int type)
82{ 85{
83 switch (type) { 86 switch (type) {
84 case META_NAT: 87 case META_NAT:
@@ -118,8 +121,10 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, int type
118 struct page *page; 121 struct page *page;
119 block_t blkno = start; 122 block_t blkno = start;
120 struct f2fs_io_info fio = { 123 struct f2fs_io_info fio = {
124 .sbi = sbi,
121 .type = META,