]> www.infradead.org Git - users/hch/configfs.git/commit
configfs: use flush file op to commit writes to a binary file configfs-for-5.9
authorLenny Szubowicz <lszubowi@redhat.com>
Thu, 16 Jul 2020 22:55:17 +0000 (18:55 -0400)
committerChristoph Hellwig <hch@lst.de>
Mon, 20 Jul 2020 13:00:08 +0000 (15:00 +0200)
commit059ccbfff8a826c0e7bfe5d69a55e1179672d8f8
tree9ec7eef056d5b61075330fcb8143aa7d8896fbc2
parent5714ee50bb4375bd586858ad800b1d9772847452
configfs: use flush file op to commit writes to a binary file

Use the flush file operation instead of the release operation to commit
the prior writes to a configfs binary file. This allows any error
status from the commit to be returned as the status of the close.

Both flush and release are invoked during a close, but the status from
release is ignored by the file system layer because the release operation
is not supposed to fail.

For example, prior to this change no error is returned to user space
when acpi_configfs correctly fails a write that attempts to commit an
ACPI aml configfs binary file when kernel lockdown is in effect.
This patch allows an error status to get returned to user space instead
of a misleading success status.

Note that during a close, release is only called on the last reference to
the specified file struct whereas flush is called on every close.
Therefore, to preserve the prior behavior, configfs_flush_bin_file()
doesn't commit the prior writes if there are still multiple references.
Additionally, since configfs does not support the fsync file operation,
a configfs flush only occurs in the context of a close. This makes it
safe to move the commit from release to flush.

Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/configfs/file.c