summaryrefslogtreecommitdiffstats
path: root/include/acpi/acoutput.h
diff options
context:
space:
mode:
authorBoris Burkov <boris@bur.io>2021-06-30 13:01:50 -0700
committerDavid Sterba <dsterba@suse.com>2021-08-23 13:19:09 +0200
commit705242538ff348874e642f2ce953e19702af411d (patch)
tree9c60a079ea062c5969e128bc7b2ac43b85e622b5 /include/acpi/acoutput.h
parent146054090b0859b28fc39015c7704ccc3c3a347f (diff)
downloadlinux-705242538ff348874e642f2ce953e19702af411d.tar.bz2
btrfs: verity metadata orphan items
Writing out the verity data is too large of an operation to do in a single transaction. If we are interrupted before we finish creating fsverity metadata for a file, or fail to clean up already created metadata after a failure, we could leak the verity items that we already committed. To address this issue, we use the orphan mechanism. When we start enabling verity on a file, we also add an orphan item for that inode. When we are finished, we delete the orphan. However, if we are interrupted midway, the orphan will be present at mount and we can cleanup the half-formed verity state. There is a possible race with a normal unlink operation: if unlink and verity run on the same file in parallel, it is possible for verity to succeed and delete the still legitimate orphan added by unlink. Then, if we are interrupted and mount in that state, we will never clean up the inode properly. This is also possible for a file created with O_TMPFILE. Check nlink==0 before deleting to avoid this race. A final thing to note is that this is a resurrection of using orphans to signal an operation besides "delete this inode". The old case was to signal the need to do a truncate. That case still technically applies for mounting very old file systems, so we need to take some care to not clobber it. To that end, we just have to be careful that verity orphan cleanup is a no-op for non-verity files. Signed-off-by: Boris Burkov <boris@bur.io> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'include/acpi/acoutput.h')
0 files changed, 0 insertions, 0 deletions