Re: [PATCH 3/9] fs/ext4: Disallow encryption if inode is DAX

From: Eric Biggers
Date: Mon May 18 2020 - 15:44:34 EST


On Mon, May 18, 2020 at 12:23:57PM -0700, Ira Weiny wrote:
> >
> > The other question is what should happen when a file is created in an encrypted
> > directory when the filesystem is mounted with -o dax. Actually, I think I
> > missed something there. Currently (based on reading the code) the DAX flag will
> > get set first, and then ext4_set_context()
>
> See this is where I am confused. Above you said that ext4_set_context() is only
> called on a directory. And I agree with you now having seen the check in
> fscrypt_ioctl_set_policy(). So what is the call path you are speaking of here?

Here's what I actually said:

ext4_set_context() is only called when FS_IOC_SET_ENCRYPTION_POLICY sets
an encryption policy on an empty directory, *or* when a new inode
(regular, dir, or symlink) is created in an encrypted directory (thus
inheriting encryption from its parent).

Just find the places where ->set_context() is called and follow them backwards.

- Eric