Skip to content

Commit ab3c5c1

Browse files
sweetteakdave
authored andcommitted
btrfs: setup qstr from dentrys using fscrypt helper
Most places where we get a struct qstr, we are doing so from a dentry. With fscrypt, the dentry's name may be encrypted on-disk, so fscrypt provides a helper to convert a dentry name to the appropriate disk name if necessary. Convert each of the dentry name accesses to use fscrypt_setup_filename(), then convert the resulting fscrypt_name back to an unencrypted qstr. This does not work for nokey names, but the specific locations that could spawn nokey names are noted. At present, since there are no encrypted directories, nothing goes down the filename encryption paths. Signed-off-by: Sweet Tea Dorminy <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent e43eec8 commit ab3c5c1

File tree

4 files changed

+189
-57
lines changed

4 files changed

+189
-57
lines changed

fs/btrfs/ctree.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <linux/refcount.h>
2929
#include <linux/crc32c.h>
3030
#include <linux/iomap.h>
31+
#include <linux/fscrypt.h>
3132
#include "extent-io-tree.h"
3233
#include "extent_io.h"
3334
#include "extent_map.h"
@@ -1674,6 +1675,8 @@ struct btrfs_new_inode_args {
16741675
*/
16751676
struct posix_acl *default_acl;
16761677
struct posix_acl *acl;
1678+
struct fscrypt_name fname;
1679+
struct qstr name;
16771680
};
16781681
int btrfs_new_inode_prepare(struct btrfs_new_inode_args *args,
16791682
unsigned int *trans_num_items);

0 commit comments

Comments
 (0)