Re: rm cannot recursively delete directory on tmpfs on RPi2

From: Mateusz Guzik <mjguzik_at_gmail.com>
Date: Fri, 7 Dec 2018 07:25:36 +0100
On 12/7/18, Jia-Shiun Li <jiashiun_at_gmail.com> wrote:
> On Fri, Dec 7, 2018 at 12:36 AM Alan Somers <asomers_at_freebsd.org> wrote:
>
>> On Wed, Dec 5, 2018 at 10:18 PM Jia-Shiun Li <jiashiun_at_gmail.com> wrote:
>> >
>> > amd64 and RPi3 do not have this issue.
>> >
>> > jsli_at_rpi2:/home/jsli 13:04 # uname -a
>> > FreeBSD rpi2 13.0-CURRENT FreeBSD 13.0-CURRENT r341419 GENERIC-NODEBUG
>> arm
>> > jsli_at_rpi2:/home/jsli 13:05 # mount -t tmpfs tmpfs /mnt
>> > jsli_at_rpi2:/home/jsli 13:05 # cd /mnt
>> > jsli_at_rpi2:/mnt 13:05 # tar xf
>> > /usr/ports/distfiles/sqlite-autoconf-3260000.tar.gz
>> > jsli_at_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_at_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_at_rpi2:/home/jsli # mount -t tmpfs tmpfs /mnt
> jsli_at_rpi2:/home/jsli # cd /mnt
> jsli_at_rpi2:/mnt # ls -R
> jsli_at_rpi2:/mnt # mkdir dir
> jsli_at_rpi2:/mnt # ls -R
> dir/
> ls: dir: directory causes a cycle
> jsli_at_rpi2:/mnt #
>
>
> looks inode no for directories are wrong
>
> jsli_at_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_at_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_at_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:

diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index a1b98c5660c..b250c54033c 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
_at__at_ -523,7 +523,7 _at__at_ int alloc_unr_specific(struct unrhdr *uh, u_int item);
 int alloc_unrl(struct unrhdr *uh);
 void free_unr(struct unrhdr *uh, u_int item);

-#if defined(__mips__) || defined(__powerpc__)
+#ifndef __LP64__
 #define UNR64_LOCKED
 #endif

-- 
Mateusz Guzik <mjguzik gmail.com>
Received on Fri Dec 07 2018 - 05:25:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:19 UTC