[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f86584f6-3877-ff18-47a1-2efaa12d18b2@huawei.com>
Date: Tue, 14 Mar 2023 20:31:43 +0800
From: Zhihao Cheng <chengzhihao1@...wei.com>
To: Jan Kara <jack@...e.cz>
CC: <tytso@....edu>, <adilger.kernel@...ger.ca>, <jack@...e.com>,
<tudor.ambarus@...aro.org>, <linux-ext4@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <yi.zhang@...wei.com>
Subject: Re: [PATCH v2 1/5] ext4: Fix reusing stale buffer heads from last
failed mounting
> On Tue 14-03-23 20:01:46, Zhihao Cheng wrote:
>> 在 2023/3/14 19:33, Jan Kara 写道:
>> Hi Jan,
>>
>>>
>>>> @@ -1271,14 +1277,8 @@ static void ext4_put_super(struct super_block *sb)
>>>> sync_blockdev(sb->s_bdev);
>>>> invalidate_bdev(sb->s_bdev);
>>
>> For journal in the inode case, journal bhs come from block device, which
>> means buffers will be dropped after this line 'invalidate_bdev(sb->s_bdev)'
>> being executed.
>
> Right, I've missed that. But then why do you remove the sbi->s_journal_bdev
> != sb->s_bdev condition below?
>
I think 'sbi->s_journal_bdev != sb->s_bdev' always becomes true if
sbi->s_journal_bdev exists.
mount_bdev
fmode_t mode = FMODE_READ | FMODE_EXCL
bdev_a = blkdev_get_by_path(dev_name, mode, fs_type)
mount_bdev->ext4_fill_super->ext4_load_and_init_journal->ext4_load_journal->ext4_get_dev_journal:
bdev_b = ext4_blkdev_get(j_dev, sb)
bdev_b = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, sb)
EXT4_SB(sb)->s_journal_bdev = bdev_b
bdev_a cannot be bdev_b, because bd_prepare_to_claim() makes sure the
same block device cannot be openned twice with mode 'FMODE_EXCL'.
Powered by blists - more mailing lists