Re: [PATCH] Btrfs: avoid setting ->d_op twice

David Sterba
Tue, 21 Feb 2012 14:52:29 -0000

Hi,

thanks for the patch!

On Tue, Feb 21, 2012 at 05:04:28PM +0800, Li Zefan
wrote:
> Follow those instructions, and you''ll trigger a warning in the
> beginning of d_set_d_op():
>
>   # mkfs.btrfs /dev/loop3
>   # mount /dev/loop3 /mnt
>   # btrfs sub create /mnt/sub
>   # btrfs sub snap /mnt /mnt/snap
>   # touch /mnt/snap/sub
>   touch: cannot touch `tmp'': Permission denied

is this the right error code? permission denied == EACCESS and this is
returned in case of file

(strace touch file)

open("file", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = -1 EACCES
(Permission denied)

while mkdir returns (strace mkdir a-dir)

mkdir("a-dir", 0777)                    = -1 EPERM (Operation not
permitted)


The commands were run as root and EPERM looks more adequate than
EACCESS.


david