All of lore.kernel.org
 help / color / mirror / Atom feed
From: yangerkun <yangerkun@huawei.com>
To: Theodore Ts'o <tytso@mit.edu>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: <yukuai3@huawei.com>
Subject: Re: [PATCH] ext4: if zeroout fails fall back to splitting the extent node
Date: Mon, 16 Aug 2021 14:57:36 +0800	[thread overview]
Message-ID: <9fdbfcce-961d-8074-e431-5d867fbf5216@huawei.com> (raw)
In-Reply-To: <2714202a-872e-aa75-7033-fb06a47b9241@huawei.com>



在 2021/8/14 10:15, yangerkun 写道:
> 
> 
> 在 2021/8/14 5:27, Theodore Ts'o 写道:
>> If the underlying storage device is using thin-provisioning, it's
>> possible for a zeroout operation to return ENOSPC.
>>
>> Commit df22291ff0fd ("ext4: Retry block allocation if we have free blocks
>> left") added logic to retry block allocation since we might get free 
>> block
>> after we commit a transaction. But the ENOSPC from thin-provisioning
>> will confuse ext4, and lead to an infinite loop.
>>
>> Since using zeroout instead of splitting the extent node is an
>> optimization, if it fails, we might as well fall back to splitting the
>> extent node.
>>
>> Reported-by: yangerkun <yangerkun@huawei.com>
>> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
>> ---
>>
>> I've run this through my battery of tests, and it doesn't cause any
>> regressions.  Yangerkun, can you test this and see if this works for
>> you?
> 
> Will do it.

Thanks for the patch, it can help us to pass the testcase. And after 
some review, it's really a better fix for me.

Thanks,
Kun.

> 
>>
>>   fs/ext4/extents.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
>> index 92ad64b89d9b..501516cadc1b 100644
>> --- a/fs/ext4/extents.c
>> +++ b/fs/ext4/extents.c
>> @@ -3569,7 +3569,7 @@ static int 
>> ext4_ext_convert_to_initialized(handle_t *handle,
>>                   split_map.m_len - ee_block);
>>               err = ext4_ext_zeroout(inode, &zero_ex1);
>>               if (err)
>> -                goto out;
>> +                goto fallback;
>>               split_map.m_len = allocated;
>>           }
>>           if (split_map.m_lblk - ee_block + split_map.m_len <
>> @@ -3583,7 +3583,7 @@ static int 
>> ext4_ext_convert_to_initialized(handle_t *handle,
>>                                 ext4_ext_pblock(ex));
>>                   err = ext4_ext_zeroout(inode, &zero_ex2);
>>                   if (err)
>> -                    goto out;
>> +                    goto fallback;
>>               }
>>               split_map.m_len += split_map.m_lblk - ee_block;
>> @@ -3592,6 +3592,7 @@ static int 
>> ext4_ext_convert_to_initialized(handle_t *handle,
>>           }
>>       }
>> +fallback:
>>       err = ext4_split_extent(handle, inode, ppath, &split_map, 
>> split_flag,
>>                   flags);
>>       if (err > 0)
>>
> .

  reply	other threads:[~2021-08-16  6:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04 12:50 [PATCH] ext4: stop return ENOSPC from ext4_issue_zeroout yangerkun
2021-08-04 13:35 ` Jan Kara
2021-08-13 15:18   ` Theodore Ts'o
2021-08-13 21:27     ` [PATCH] ext4: if zeroout fails fall back to splitting the extent node Theodore Ts'o
2021-08-14  2:15       ` yangerkun
2021-08-16  6:57         ` yangerkun [this message]
2021-09-26 11:35       ` yangerkun
2021-11-23  9:27         ` Jan Kara
2021-11-24  9:01           ` yangerkun
2021-11-24 10:37             ` Jan Kara
2021-11-24 12:11               ` yangerkun
2021-11-24 17:15                 ` Jan Kara
2021-08-16 10:05     ` [PATCH] ext4: stop return ENOSPC from ext4_issue_zeroout Jan Kara
2021-08-16 14:16       ` Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9fdbfcce-961d-8074-e431-5d867fbf5216@huawei.com \
    --to=yangerkun@huawei.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.