From: Eric Ren <zren@suse.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH v2] ocfs2: retry on ENOSPC if sufficient space in truncate log
Date: Thu, 7 Jul 2016 17:59:12 +0800 [thread overview]
Message-ID: <577E27F0.2010700@suse.com> (raw)
In-Reply-To: <577DA9C5.1050503@huawei.com>
Hi Joseph,
On 07/07/2016 09:00 AM, Joseph Qi wrote:
>> @@ -1164,7 +1164,8 @@ static int ocfs2_reserve_clusters_with_limit(struct ocfs2_super *osb,
>> int flags,
>> struct ocfs2_alloc_context **ac)
>> {
>> - int status;
>> + int status, ret = 0;
>> + int retried = 0;
>>
>> *ac = kzalloc(sizeof(struct ocfs2_alloc_context), GFP_KERNEL);
>> if (!(*ac)) {
>> @@ -1189,7 +1190,24 @@ static int ocfs2_reserve_clusters_with_limit(struct ocfs2_super *osb,
>> }
>>
>> if (status == -ENOSPC) {
>> +retry:
>> status = ocfs2_reserve_cluster_bitmap_bits(osb, *ac);
>> + /* Retry if there is sufficient space cached in truncate log */
>> + if (status == -ENOSPC && !retried) {
>> + retried = 1;
>> + ocfs2_inode_unlock((*ac)->ac_inode, 1);
>> + inode_unlock((*ac)->ac_inode);
>> +
>> + ret = ocfs2_try_to_free_truncate_log(osb, bits_wanted);
>> + if (ret == 1)
>> + goto retry;
>> +
>> + if (ret < 0) {
>> + mlog_errno(ret);
>> + inode_lock((*ac)->ac_inode);
>> + ocfs2_inode_lock((*ac)->ac_inode, NULL, 1);
>> + }
> Here not only the case error occurs in ocfs2_try_to_free_truncate_log,
> but also have tried to free truncate log but still no space, you have
> already unlocked inode and it will still call ocfs2_free_alloc_context
> and unlock again.
> I suggest here we consider a bit code refactoring but not just lock
> again.
Oh, yes! "< 0" means error and "0" means no space. I also considered the
possibility of refactoring somehow. But it needs plenty of changes
because of DLM glue layer doesn't keep track of the lock holder@
process level. I know it looks ugly and inefficient, but fortunately
the chance of hitting here is very little, so I think it doesn't worth
a refactor. Any suggestions?
Eric
>
> Thanks,
> Joseph
>
>> + }
>> if (status < 0) {
>> if (status != -ENOSPC)
>> mlog_errno(status);
prev parent reply other threads:[~2016-07-07 9:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-06 10:57 [Ocfs2-devel] [PATCH v2] ocfs2: retry on ENOSPC if sufficient space in truncate log Eric Ren
2016-07-07 1:00 ` Joseph Qi
2016-07-07 9:59 ` Eric Ren [this message]
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=577E27F0.2010700@suse.com \
--to=zren@suse.com \
--cc=ocfs2-devel@oss.oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).