Subject: bug#12301: tail -F & ZFS

From: Pádraig Brady <[email-masked]>
Date: Wed, 29 Aug 2012 17:11:54 +0100

On 08/29/2012 04:13 PM, Jim Meyering wrote:
> reopen 12301
> thanks
> 
> Erik Auerswald wrote:
>> On Wed, Aug 29, 2012 at 11:33:13AM +0200, Bernhard Voelker wrote:
>>> On 08/29/2012 11:12 AM, Jim Meyering wrote:
>>>>> Can we be sure that 0x2fc12fc1 is used for all ZFS
>>>>> implementations?
>>>>
>>>> If there end up being two or more magic numbers for the same file
>>>> system (or ZFS variants going by new names), we'll adapt.
>>>
>>> Ok, that sounds good. Thanks.
>>
>> How can I check this magic number on a Solaris 10 system with ZFS?
>> Neither GNU coreutils nor a C compiler installed. :-(
>>
>> $ uname -a
>> SunOS demchpux 5.10 Generic_138888-08 sun4v sparc SUNW,SPARC-Enterprise-T5120
>> $ df -n /
>> /                  : zfs
>> $ df -g /
>> /                  (/                 ):       131072 block size           512 frag size
>>        0 total blocks   82144537 free blocks 82144537 available       82388038 total files
>> 82144537 free files     67174412 filesys id
>>      zfs fstype       0x00000004 flag             255 filename length
> 
> Thanks for your interest.
> If you have perl of python, you can have them call statvfs,
> then simply run truss on the script and you'll see what
> statvfs produces, one field of which should be an "fsid" member:
> 
> However, your query prompted me to build the latest on
> a Solaris 10 system and see:
> 
>     sol10$ ./stat --fo=%T -f /
>     zfs
>     sol10$ truss -v statvfs ./stat --fo=%T -f /
>     ...
>     statvfs64("/", 0xFFBFFAA8)                      = 0
>             bsize=131072     frsize=512       blocks=117101360 bfree=92845257
>             bavail=92845257  files=93143101   ffree=92845257  favail=92845257
>             fsid=0x4010002   basetype=zfs     namemax=255
>             flag=ST_NOTRUNC
>             fstr=""
>     ...
> 
> Hmm... fsid=0x4010002.
> That is definitely not the same number as what is now recorded in
> stat.c, so this deserves more investigation:
> 
>     case S_MAGIC_ZFS: /* 0x2FC12FC1 local */
>       return "zfs";
> 
> This also shows there is room for improvement.
> (should print the hexadecimal FSID):
> 
>     sol10$ ./stat --fo=%t -f /
>     ?
> 
> This latter might deserve its own bug, but for now,
> I've simply reopened the original ZFS-related bug.

I don't think there is an issue here.

fsid is a per file system rather than per file system type.
So '?' is correct on Solaris as it doesn't expose the file
system type ID (it doesn't have statfs).

Also tail will default to the more portable polling
method when f_type is not available.

cheers,
Pádraig.