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

Li Zefan
Wed, 22 Feb 2012 01:29:45 -0000

David Sterba wrote:
> 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.
>

This is a different issue, and EPERM is returned by VFS not btrfs.

Feel free to submit a patch to fsdevel for discussion.