PFS in HAMMER1

Tomohiro Kusumi kusumi.tomohiro at gmail.com
Fri Jun 17 07:16:44 PDT 2016


I tried a kernel built with ";" for the separator instead of ":" to
see if the existing hammer partitions can really boot.

As a result it did boot.

[root@]~# ls -l /pfs
total 0
lrwxr-xr-x  1 root  wheel  10 Aug 26  2015 home -> @@-1;00003
lrwxr-xr-x  1 root  wheel  10 Aug 26  2015 tmp -> @@-1;00002
lrwxr-xr-x  1 root  wheel  10 Aug 26  2015 usr.obj -> @@-1;00004
lrwxr-xr-x  1 root  wheel  10 Aug 26  2015 var -> @@-1;00001
lrwxr-xr-x  1 root  wheel  10 Aug 26  2015 var.crash -> @@-1;00005
lrwxr-xr-x  1 root  wheel  10 Aug 26  2015 var.tmp -> @@-1;00006

This one is a non-root fs mounted on /HAMMER.

[root@]~# newfs_hammer -L TEST /dev/da1 > /dev/null
[root@]~# mount_hammer /dev/da1 /HAMMER
[root@]~# cd /HAMMER
[root@]/HAMMER# hammer pfs-master test1 > /dev/null
[root@]/HAMMER# ls -l
total 0
lrwxr-xr-x  1 root  wheel  10 Jun 17 22:44 test1 -> @@-1;00001

As I mentioned in the first post, HAMMER interprets "@@PFS00001" to
"@@-1:00001" via readlink(2), so "@@-1:00001" (or "@@-1;00001")
doesn't exist within the symlink itself. This makes it possible to
boot the filesystem once created with kernel that uses ":".

/* direntry of "test1" symlink */
G------ ELM  1 R lo=00000001 obj=0000000000000001 rt=11
key=0ab2dce256500000 tid=0000000100008020
                 del=0000000000000000 ot=07
dataoff=9000000021000350/21 crc=f6f91656 fill=z9:v0:0:66:848=1%
                 dir-entry ino=0000000100000455 lo=00000000 name="test1"

/* inode of "test1" symlink */
G------ ELM  2 R lo=00000001 obj=0000000100000455 rt=01
key=0000000000000000 tid=0000000100008020
                 del=0000000000000000 ot=07
dataoff=90000000210002d0/128 crc=a09f96bc fill=z9:v0:0:66:720=1%
                 inode size=10 nlinks=1 mode=00755 uflags=00000000
caps=00 pobjid=0000000000000001 ot=07
                       ctime=000535798eb80478 mtime=000535798eb80478
atime=000535798eb80478 symlink="@@PFS00001"


2016-06-17 22:14 GMT+09:00 Michael Neumann <mneumann at ntecs.de>:
>
>
> On 06/17/16 14:15, Tomohiro Kusumi wrote:
>>
>> Technically speaking, we could change the format of "@@-1:00001" to
>> "@@-1something00001" without breaking userspace unless userspace use
>> raw PFS name "@@-1:00001" for some reasons.
>
>
> that would be great. maybe something else than the "empty word" would be
> better.
>
>> In the previous post, I intentionally used raw PFS name, but users or
>> userspace programs basically never directly use this format, so it
>> really doesn't matter if the separator is ":" or something else as
>> long as there is something between.
>>
>> In other words, when we have
>>
>> # ls -l /pfs/var.tmp
>> lrwxr-xr-x  1 root  wheel  10 Aug 26  2015 /pfs/var.tmp -> @@-1:00006
>> # grep "/var/tmp" /etc/fstab
>> /pfs/var.tmp    /var/tmp                null    rw              0       0
>>
>> users would do
>>
>> # cd /pfs/var.tmp
>> or
>> # cd /var/tmp
>>
>> but users most likely never do
>>
>> # cd /pfs/@@-1:00006
>> or
>> # cd /@@-1:00006
>> or
>> # cd /var/tmp/@@-1:00006
>> or
>> # cd /pfs/@@-1:00006/@@-1:00006/@@-1:00006/@@-1:00006
>> or
>> # cd /@@-1:00001/@@-1:00002/@@-1:00003/@@-1:00004/@@-1:00005/@@-1:00006
>>
>> which are all the same.
>
>
> it's correct that users wouldn't do that directly, but the sysctl
> KERN_PROC_PATHNAME returns such a path which is used by programs like rust.
> they assume that paths can be separated by ":" and as such are not allowed
> to themselves contain a ":".
>
> the current solution is to patch rust is a very ugly way, by hardcoding the
> path "/usr/local/bin/rust" to avoid the sysctl (or reading from /proc
> filesystem). this clearly is not a good solution.
>
> Regards,
>
>   Michael
>
>
>>
>>
>> 2016-06-17 0:28 GMT+09:00 Michael Neumann <mneumann at ntecs.de>:
>>>
>>>
>>>
>>> On 06/16/16 02:26, Tomohiro Kusumi wrote:
>>>>
>>>>
>>>> There was discussion about @@ in PFS path on irc channel a few days
>>>> ago. This post has nothing to do with it, but explains what that @@
>>>> really means. This is very tricky, so most users probably had
>>>> difficult time understanding what this @@ means.
>>>
>>>
>>>
>>> This is a bit off-topic, but related to the PFS naming. Having ":" in the
>>> path causes a lot of trouble. Dunno if this issue has been brought up by
>>> jmarino. One such situation is the sysctl KERN_PROC_PATHNAME, e.g. used
>>> by
>>> rust to find the path of the executable. The problem arises when this is
>>> used in a PATH variable, as ":" is used there as a separator as well. The
>>> alternative is using /proc/curproc/cmdline, but this requires a mounted
>>> /proc filesystem which causes problems with the synth builder.
>>>
>>> Regards,
>>>
>>>   Michael
>>>
>



More information about the Users mailing list