All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kazuo Ito <ito_kazuo_g3@lab.ntt.co.jp>
To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com
Cc: linux-nfs@vger.kernel.org, konishi.ryusuke@lab.ntt.co.jp,
	OS渡辺 <watanabe.hiroyuki@lab.ntt.co.jp>
Subject: [PATCH v2 1/2] pNFS: Fix potential corruption of page being written
Date: Thu, 14 Feb 2019 18:36:58 +0900	[thread overview]
Message-ID: <480b4d46-e290-b612-7b8e-09eb3a488ee6@lab.ntt.co.jp> (raw)

nfs_want_read_modify_write() didn't check for !PagePrivate when pNFS
block or SCSI layout was in use, therefore we could lose data forever
if the page being written was filled by a read before completion.

Signed-off-by: Kazuo Ito <ito_kazuo_g3@lab.ntt.co.jp>
---
 fs/nfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 29553fdba8af..d8f25b1ae233 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -299,7 +299,7 @@ static int nfs_want_read_modify_write(struct file *file, struct page *page,
 	unsigned int end = offset + len;
 
 	if (pnfs_ld_read_whole_page(file->f_mapping->host)) {
-		if (!PageUptodate(page))
+		if (!PageUptodate(page) && !PagePrivate(page))
 			return 1;
 		return 0;
 	}
-- 
2.20.1


                 reply	other threads:[~2019-02-14  9:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=480b4d46-e290-b612-7b8e-09eb3a488ee6@lab.ntt.co.jp \
    --to=ito_kazuo_g3@lab.ntt.co.jp \
    --cc=anna.schumaker@netapp.com \
    --cc=konishi.ryusuke@lab.ntt.co.jp \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    --cc=watanabe.hiroyuki@lab.ntt.co.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.