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>