[Devel,rh7] ext4: ext4_mkdir must set S_IOPS_WRAPPER bit

Submitted by Maxim Patlasov on July 25, 2016, 9:01 p.m.

Details

Message ID 20160725210052.9843.5022.stgit@maxim-thinkpad
State New
Series "ext4: ext4_mkdir must set S_IOPS_WRAPPER bit"
Headers show

Commit Message

Maxim Patlasov July 25, 2016, 9:01 p.m.
ext4_iget() sets this bit for directories. Let's do the same in ext4_mkdir().
Otherwise, the behaviour of vfs_rename (on top of ext4) varies depending on
how the in-core inode was born: via lookup or mkdir.

The key place in vfs_rename sensible to the change is:

>	if (flags && !rename2)
>		return -EINVAL;

Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
---
 fs/ext4/namei.c |    1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 0adc6df..bebe698 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2413,6 +2413,7 @@  retry:
 
 	inode->i_op = &ext4_dir_inode_operations.ops;
 	inode->i_fop = &ext4_dir_operations;
+	inode->i_flags |= S_IOPS_WRAPPER;
 	err = ext4_init_new_dir(handle, dir, inode);
 	if (err)
 		goto out_clear_inode;

Comments

Konstantin Khorenko July 29, 2016, 3:15 p.m.
Maxim, will you send the patch to mainstream as well?

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 07/26/2016 12:01 AM, Maxim Patlasov wrote:
> ext4_iget() sets this bit for directories. Let's do the same in ext4_mkdir().
> Otherwise, the behaviour of vfs_rename (on top of ext4) varies depending on
> how the in-core inode was born: via lookup or mkdir.
>
> The key place in vfs_rename sensible to the change is:
>
>> 	if (flags && !rename2)
>> 		return -EINVAL;
>
> Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
> ---
>  fs/ext4/namei.c |    1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 0adc6df..bebe698 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -2413,6 +2413,7 @@ retry:
>
>  	inode->i_op = &ext4_dir_inode_operations.ops;
>  	inode->i_fop = &ext4_dir_operations;
> +	inode->i_flags |= S_IOPS_WRAPPER;
>  	err = ext4_init_new_dir(handle, dir, inode);
>  	if (err)
>  		goto out_clear_inode;
>
> .
>
Maxim Patlasov July 29, 2016, 6:09 p.m.
Kostya, ms is not affected,  RedHat bz ticket: 
https://bugzilla.redhat.com/show_bug.cgi?id=1361682


On 07/29/2016 08:15 AM, Konstantin Khorenko wrote:
> Maxim, will you send the patch to mainstream as well?
>
> -- 
> Best regards,
>
> Konstantin Khorenko,
> Virtuozzo Linux Kernel Team
>
> On 07/26/2016 12:01 AM, Maxim Patlasov wrote:
>> ext4_iget() sets this bit for directories. Let's do the same in 
>> ext4_mkdir().
>> Otherwise, the behaviour of vfs_rename (on top of ext4) varies 
>> depending on
>> how the in-core inode was born: via lookup or mkdir.
>>
>> The key place in vfs_rename sensible to the change is:
>>
>>>     if (flags && !rename2)
>>>         return -EINVAL;
>>
>> Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
>> ---
>>  fs/ext4/namei.c |    1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
>> index 0adc6df..bebe698 100644
>> --- a/fs/ext4/namei.c
>> +++ b/fs/ext4/namei.c
>> @@ -2413,6 +2413,7 @@ retry:
>>
>>      inode->i_op = &ext4_dir_inode_operations.ops;
>>      inode->i_fop = &ext4_dir_operations;
>> +    inode->i_flags |= S_IOPS_WRAPPER;
>>      err = ext4_init_new_dir(handle, dir, inode);
>>      if (err)
>>          goto out_clear_inode;
>>
>> .
>>