Thread (30 messages) 30 messages, 3 authors, 2017-09-21
STALE3183d

[PATCH 20/25] f2fs: switch to fscrypt_prepare_setattr()

From: Eric Biggers <hidden>
Date: 2017-09-20 22:47:13
Also in: linux-f2fs-devel, linux-fscrypt, linux-fsdevel
Subsystem: f2fs file system, filesystems (vfs and infrastructure), the rest · Maintainers: Jaegeuk Kim, Chao Yu, Alexander Viro, Christian Brauner, Linus Torvalds

From: Eric Biggers <redacted>

Signed-off-by: Eric Biggers <redacted>
---
 fs/f2fs/file.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 8cef3931a00b..629bb91fa44e 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -714,6 +714,10 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
 	if (err)
 		return err;
 
+	err = fscrypt_prepare_setattr(dentry, attr);
+	if (err)
+		return err;
+
 	if (is_quota_modification(inode, attr)) {
 		err = dquot_initialize(inode);
 		if (err)
@@ -729,14 +733,6 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
 	}
 
 	if (attr->ia_valid & ATTR_SIZE) {
-		if (f2fs_encrypted_inode(inode)) {
-			err = fscrypt_get_encryption_info(inode);
-			if (err)
-				return err;
-			if (!fscrypt_has_encryption_key(inode))
-				return -ENOKEY;
-		}
-
 		if (attr->ia_size <= i_size_read(inode)) {
 			down_write(&F2FS_I(inode)->i_mmap_sem);
 			truncate_setsize(inode, attr->ia_size);
-- 
2.14.1.821.g8fa685d3b7-goog


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help