[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20140919.084107.1306407610758412217.konishi.ryusuke@lab.ntt.co.jp>
Date: Fri, 19 Sep 2014 08:41:07 +0900 (JST)
From: Ryusuke Konishi <konishi.ryusuke@....ntt.co.jp>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-nilfs@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
Andreas Rohner <andreas.rohner@....net>
Subject: Re: [PATCH] nilfs2: fix data loss with mmap()
On Thu, 18 Sep 2014 12:17:08 -0700, Andrew Morton wrote:
> On Thu, 18 Sep 2014 23:56:25 +0900 Ryusuke Konishi <konishi.ryusuke@....ntt.co.jp> wrote:
>
>> From: Andreas Rohner <andreas.rohner@....net>
>>
>> This bug leads to reproducible silent data loss, despite the use of
>> msync(), sync() and a clean unmount of the file system. It is easily
>> reproducible with the following script:
>>
>> ...
>>
>> --- a/fs/nilfs2/inode.c
>> +++ b/fs/nilfs2/inode.c
>> @@ -219,10 +219,10 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc)
>>
>> static int nilfs_set_page_dirty(struct page *page)
>> {
>> + struct inode *inode = page->mapping->host;
>> int ret = __set_page_dirty_nobuffers(page);
>>
>> if (page_has_buffers(page)) {
>> - struct inode *inode = page->mapping->host;
>> unsigned nr_dirty = 0;
>> struct buffer_head *bh, *head;
>>
>> @@ -245,6 +245,10 @@ static int nilfs_set_page_dirty(struct page *page)
>>
>> if (nr_dirty)
>> nilfs_set_file_dirty(inode, nr_dirty);
>> + } else if (ret) {
>> + unsigned nr_dirty = 1 << (PAGE_SHIFT - inode->i_blkbits);
>
> It's quite cosmetic, but it is conventional to use PAGE_CACHE_SHIFT here.
Agreed.
Thanks,
Ryusuke Konishi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists