From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: Miao Xie <miaoxie@huawei.com>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH RESEND v4 2/8] btrfs: Make btrfs_parse_options() parse mount option in a atomic way
Date: Fri, 30 Jan 2015 09:33:17 +0800 [thread overview]
Message-ID: <54CADF5D.4000003@cn.fujitsu.com> (raw)
In-Reply-To: <54CADE7D.5000607@huawei.com>
-------- Original Message --------
Subject: Re: [PATCH RESEND v4 2/8] btrfs: Make btrfs_parse_options()
parse mount option in a atomic way
From: Miao Xie <miaoxie@huawei.com>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>, <linux-btrfs@vger.kernel.org>
Date: 2015年01月30日 09:29
> On Fri, 30 Jan 2015 09:20:46 +0800, Qu Wenruo wrote:
>>> Here need ACCESS_ONCE to wrap info->mount_opt, or the complier might use
>>> info->mount_opt instead of new_opt.
>> Thanks for pointing out this one.
>>> But I worried that this is not key reason of the wrong space cache. Could
>>> you explain the race condition which caused the wrong space cache?
>>>
>>> Thanks
>>> Miao
>> CPU0:
>> remount()
>> |- sync_fs() <- after sync_fs() we can start new trans
>> |- btrfs_parse_options() CPU1:
>> |- start_transaction()
>> |- Do some bg allocation, not recorded in space_cache.
> I think it is a bug if a free space is not recorded in space cache. Could you
> explain why it is not recorded?
>
> Thanks
> Miao
IIRC, in that window, the fs_info->mount_opt's SPACE_CACHE bit is cleared.
So space cache is not recorded.
Thanks,
Qu
>
>> |- set SPACE_CACHE bit due to cache_gen
>>
>> |- commit_transaction()
>> |- write space cache and update cache_gen.
>> but since some of it is not recorded in space cache,
>> the space cache missing some records.
>> |- clear SPACE_CACHE bit dut to nospace_cache
>>
>> So the space cache is wrong.
>>
>> Thanks,
>> Qu
>>>> + }
>>>> kfree(orig);
>>>> return ret;
>>>> }
>>>>
>> .
>>
next prev parent reply other threads:[~2015-01-30 1:33 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-29 2:24 [PATCH RESEND v4 0/8] Fix freeze/sysfs deadlock in better method Qu Wenruo
2015-01-29 2:24 ` [PATCH RESEND v4 1/8] Revert "btrfs: add support for processing pending changes" related commits Qu Wenruo
2015-01-29 2:24 ` [PATCH RESEND v4 2/8] btrfs: Make btrfs_parse_options() parse mount option in a atomic way Qu Wenruo
2015-01-30 0:31 ` Miao Xie
2015-01-30 1:20 ` Qu Wenruo
2015-01-30 1:29 ` Miao Xie
2015-01-30 1:33 ` Qu Wenruo [this message]
2015-01-30 2:06 ` Miao Xie
2015-01-30 2:51 ` Qu Wenruo
2015-01-30 3:21 ` Miao Xie
2015-01-30 3:25 ` Qu Wenruo
2015-01-29 2:24 ` [PATCH RESEND v4 3/8] btrfs: Introduce per-transaction mount_opt to keep mount option consistent during transaction Qu Wenruo
2015-01-29 2:24 ` [PATCH RESEND v4 4/8] btrfs: Use btrfs_test_trans_opt() to handle SPACE_CACHE if it's under transaction protect Qu Wenruo
2015-01-29 2:24 ` [PATCH RESEND v4 5/8] btrfs: Use btrfs_test_trans_opt() to handle INODE_CACHE " Qu Wenruo
2015-01-29 2:24 ` [PATCH RESEND v4 6/8] vfs: Add get_vfsmount_sb() function to get vfsmount from a given sb Qu Wenruo
2015-01-29 12:37 ` David Sterba
2015-01-29 15:23 ` Al Viro
2015-01-30 1:11 ` Qu Wenruo
2015-01-30 2:09 ` Al Viro
2015-01-30 2:20 ` Qu Wenruo
2015-01-30 0:52 ` Miao Xie
2015-01-30 1:44 ` Qu Wenruo
2015-01-30 2:02 ` Qu Wenruo
2015-01-30 3:22 ` Miao Xie
2015-01-30 3:30 ` Qu Wenruo
2015-01-30 2:14 ` Al Viro
2015-01-30 4:14 ` Miao Xie
2015-01-30 4:37 ` Al Viro
2015-01-30 5:34 ` Miao Xie
2015-01-30 6:15 ` Al Viro
2015-01-30 5:30 ` Qu Wenruo
2015-01-29 2:24 ` [PATCH RESEND v4 7/8] btrfs: Use mnt_want_write() to protect label change Qu Wenruo
2015-01-29 2:24 ` [PATCH RESEND v4 8/8] btrfs: Use mnt_want_write() to protect sysfs feature change Qu Wenruo
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=54CADF5D.4000003@cn.fujitsu.com \
--to=quwenruo@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=miaoxie@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 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).