mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: linux-nilfs <linux-nilfs@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Andreas Rohner <andreas.rohner@gmx.net>
Subject: Re: [PATCH] nilfs2: fix data loss with mmap()
Date: Thu, 18 Sep 2014 12:17:08 -0700	[thread overview]
Message-ID: <20140918121708.c9e9678c9ea76b057377d843@linux-foundation.org> (raw)
In-Reply-To: <1411052185-8118-2-git-send-email-konishi.ryusuke@lab.ntt.co.jp>

On Thu, 18 Sep 2014 23:56:25 +0900 Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> wrote:

> From: Andreas Rohner <andreas.rohner@gmx.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.

  reply	other threads:[~2014-09-18 19:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18 14:56 [PATCH 0/1] " Ryusuke Konishi
2014-09-18 14:56 ` [PATCH] " Ryusuke Konishi
2014-09-18 19:17   ` Andrew Morton [this message]
2014-09-18 23:41     ` Ryusuke Konishi

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=20140918121708.c9e9678c9ea76b057377d843@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=andreas.rohner@gmx.net \
    --cc=konishi.ryusuke@lab.ntt.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nilfs@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®