ext4 crypto: use a jbd2 transaction when adding a crypto policy
authorTheodore Ts'o <tytso@mit.edu>
Fri, 17 Jul 2015 15:16:47 +0000 (11:16 -0400)
committerIan Chang <ianc@nvidia.com>
Wed, 1 Jun 2016 05:00:05 +0000 (13:00 +0800)
commit8a3a934acdaa7645eac66a4fecd6874355a5208e
tree9e1138cb0632f7756032c05d43d56e3e5258e2c7
parentd4fe8073b53b0756c422cb1b3dd044b9d720f410
ext4 crypto: use a jbd2 transaction when adding a crypto policy

Start a jbd2 transaction, and mark the inode dirty on the inode under
that transaction after setting the encrypt flag.  Otherwise if the
directory isn't modified after setting the crypto policy, the
encrypted flag might not survive the inode getting pushed out from
memory, or the the file system getting unmounted and remounted.

Change-Id: I5868e0531881922d8a5e68fa88b6cf2bb1675b99
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>
Reviewed-on: http://git-master/r/1154514
Reviewed-by: Ian Chang <ianc@nvidia.com>
Tested-by: Ian Chang <ianc@nvidia.com>
fs/ext4/crypto_policy.c