[syslinux] [PATCH v2] extlinux: Make sure ldlinux.sys file is installed

H. Peter Anvin hpa at zytor.com
Wed Jan 9 13:36:38 PST 2013


On 01/09/2013 11:17 AM, Matt Fleming wrote:
> On Mon, 2013-01-07 at 06:14 -0200, Paulo Alcantara wrote:
>> Due to delayed allocation feature on XFS filesystems, a write is not
>> guaranteed to flushed out to the underlying file system after crash or
>> something else - so we need to make sure that ldlinux.sys is installed
>> correctly in the mounted filesystem.
>>
>> Signed-off-by: Paulo Alcantara <pcacjr at zytor.com>
>> ---
>>  extlinux/main.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/extlinux/main.c b/extlinux/main.c
>> index 0204caa..f90ca11 100644
>> --- a/extlinux/main.c
>> +++ b/extlinux/main.c
>> @@ -687,6 +687,8 @@ static int xfs_install_file(const char *path, int devfd, struct stat *rst)
>>      }
>>  
>>      close(dirfd);
>> +
>> +    fsync(fd);
>>      close(fd);
>>  
>>      return 0;
> 
> Looks good. Applied, thanks!
> 

Actually it turns out that fsync() doesn't guarantee that the directory
entry has hit disk.  syncfs() is quite new (Linux 2.6.39) so it might be
better to just use sync() here.  Bootloader installation isn't too
horribly common anyway.

	-hpa



More information about the Syslinux mailing list