Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Dec 2018 10:59:41 +0100
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        mmel@freebsd.org
Cc:        freebsd-current@freebsd.org
Subject:   Re: rm cannot recursively delete directory on tmpfs on RPi2
Message-ID:  <CAGudoHE_8oObwGxsq2_=qE7Ah5d_OT2wwnMKXtTacqKUJERZ4Q@mail.gmail.com>
In-Reply-To: <16c12239-031e-14fd-e82a-450b242338c5@freebsd.org>
References:  <CAHNYxxOxnunpBnU4_DoLjfFcVdJ5p7jDqYwSrYgm3S-weUNBew@mail.gmail.com> <CAOtMX2jTJ0Kk%2Bf%2Bc%2BZ_ZwFx4q4GrxRFgrUTof78b035j0KaYPQ@mail.gmail.com> <CAHNYxxPFZ012DEobiix9Wk4M8X5kuBMrzKDmnT=4YHsfd-1tEA@mail.gmail.com> <CAGudoHGc%2BD3Cj74pq07vz-HzRwDGywkr4TK0aWAk1AaDqHAn6g@mail.gmail.com> <16c12239-031e-14fd-e82a-450b242338c5@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 12/7/18, Michal Meloun <melounmichal@gmail.com> wrote:
>
>
> On 07.12.2018 7:25, Mateusz Guzik wrote:
>> On 12/7/18, Jia-Shiun Li <jiashiun@gmail.com> wrote:
>>> On Fri, Dec 7, 2018 at 12:36 AM Alan Somers <asomers@freebsd.org> wrote:
>>>
>>>> On Wed, Dec 5, 2018 at 10:18 PM Jia-Shiun Li <jiashiun@gmail.com>
>>>> wrote:
>>>>>
>>>>> amd64 and RPi3 do not have this issue.
>>>>>
>>>>> jsli@rpi2:/home/jsli 13:04 # uname -a
>>>>> FreeBSD rpi2 13.0-CURRENT FreeBSD 13.0-CURRENT r341419 GENERIC-NODEBUG
>>>> arm
>>>>> jsli@rpi2:/home/jsli 13:05 # mount -t tmpfs tmpfs /mnt
>>>>> jsli@rpi2:/home/jsli 13:05 # cd /mnt
>>>>> jsli@rpi2:/mnt 13:05 # tar xf
>>>>> /usr/ports/distfiles/sqlite-autoconf-3260000.tar.gz
>>>>> jsli@rpi2:/mnt 13:05 # rm -rf sqlite-autoconf-3260000/
>>>>> rm: sqlite-autoconf-3260000/tea: Operation not permitted
>>>>> rm: sqlite-autoconf-3260000/: Directory not empty
>>>>> jsli@rpi2:/mnt 13:05 #
>>>>>
>>>>> -Jia-Shiun
>>>>
>>>> Did you check for file flags?  Do "ls -lod
>>>> sqlite-autoconf-3260000/tea".
>>>>
>>>>
>>> Unlikely caused by flags I think.
>>>
>>> jsli@rpi2:/home/jsli # mount -t tmpfs tmpfs /mnt
>>> jsli@rpi2:/home/jsli # cd /mnt
>>> jsli@rpi2:/mnt # ls -R
>>> jsli@rpi2:/mnt # mkdir dir
>>> jsli@rpi2:/mnt # ls -R
>>> dir/
>>> ls: dir: directory causes a cycle
>>> jsli@rpi2:/mnt #
>>>
>>>
>>> looks inode no for directories are wrong
>>>
>>> jsli@rpi2:/mnt # ll -ia
>>> total 4
>>> 2 drwxr-xr-x   3 root  wheel   36 Dec  7 09:55 ./
>>> 2 drwxr-xr-x  23 root  wheel  512 Dec  3 17:04 ../
>>> 2 drwxr-xr-x   2 root  wheel    0 Dec  7 09:55 dir/
>>> jsli@rpi2:/mnt # ll -ia dir
>>> total 0
>>> 2 drwxr-xr-x  2 root  wheel   0 Dec  7 09:55 ./
>>> 2 drwxr-xr-x  3 root  wheel  36 Dec  7 09:55 ../
>>> jsli@rpi2:/mnt #
>>>
>>
>> Ouch.
>>
>> Looks like 64-bit atomic on 32-bit arm don't work as advertised.
>>
>> While they should be fixed, I have been meaning to commit the following
>> which will have a side effect of taking care of the bug you ran into:
>>
>
> Mateusz,
> where you see problem with 64-bit atomic on arm? I'm not aware of any
> problem in this area.

inode allocation for tmpfs (and other places) was recently changed to use
64-bit atomics (excluding mips and powerpc). So far atomic_fetchadd_64
failing to bump the number on 32-bit arm (at least for the variant used
by whatever is put on rpi2) looks like a decent explanation. The code
definitely works on amd64.

-- 
Mateusz Guzik <mjguzik gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGudoHE_8oObwGxsq2_=qE7Ah5d_OT2wwnMKXtTacqKUJERZ4Q>