From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lingzhu Xiang Subject: File lingers after deletion with efivarfs_write_file Date: Wed, 26 Dec 2012 18:29:30 +0800 Message-ID: <50DAD18A.6050404@redhat.com> References: <1351237923-10313-1-git-send-email-matt@console-pimps.org> <1351237923-10313-3-git-send-email-matt@console-pimps.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1351237923-10313-3-git-send-email-matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org> Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Jeremy Kerr Cc: Matt Fleming , linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Matthew Garrett , Andy Whitcroft , Jan Beulich , Chun-Yi Lee , Matt Fleming , joeyli List-Id: linux-efi@vger.kernel.org On 10/26/2012 03:51 PM, Matt Fleming wrote: > From: Jeremy Kerr > > A write to an efivarfs file will not always result in a variable of > 'count' size after the EFI SetVariable() call. We may have appended to > the existing data (ie, with the EFI_VARIABLE_APPEND_WRITE attribute), or > even have deleted the variable (with an authenticated variable update, > with a zero datasize). > > This change re-reads the updated variable from firmware, to check for > size changes and deletions. In the latter case, we need to drop the > dentry. File lingers after deletion with efivarfs_write_file. Reproduced on QEMU/OVMF, 3.8-rc vanilla kernel. Choosing the variable RTC because it's been generated by OVMF when mounting. Steps to reproduce (bash commandline): # P=/sys/firmware/efi/efivars # VAR=$P/RTC-378d7b65-8da9-4773-b6e4-a47826a833e1 # mount -t efivarfs - $P # stat -c'%s %h' $VAR 8 1 # dd if=/dev/zero of=$VAR bs=4 count=1 conv=notrunc 2>&- # stat -c'%s %h' $VAR 8 0 Writing four null bytes to $VAR should delete it. -- Lingzhu Xiang