public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@primarydata.com>
To: Peng Tao <bergwolf@gmail.com>
Cc: shaobingqing <shaobingqing@bwstor.com.cn>,
	linuxnfs <linux-nfs@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] NFSv4.1: Fix a race in nfs4_write_inode
Date: Thu, 16 Jan 2014 12:11:11 -0500	[thread overview]
Message-ID: <C6749CD6-1F47-42C5-8E27-A11167BF69E4@primarydata.com> (raw)
In-Reply-To: <CA+a=Yy6uf73Y=F5-Jp+2VrzMmbTYZXqDaEj-EHX335M3ZCvEZA@mail.gmail.com>


On Jan 16, 2014, at 10:49, Peng Tao <bergwolf@gmail.com> wrote:
> On Tue, Jan 14, 2014 at 2:45 AM, Trond Myklebust
> <trond.myklebust@primarydata.com> wrote:
>> void pnfs_set_lo_fail(struct pnfs_layout_segment *lseg)
>> @@ -1881,43 +1887,37 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)
>>        struct nfs4_layoutcommit_data *data;
>>        struct nfs_inode *nfsi = NFS_I(inode);
>>        loff_t end_pos;
>> -       int status = 0;
>> +       int status;
>> 
>> -       dprintk("--> %s inode %lu\n", __func__, inode->i_ino);
>> -
>> -       if (!test_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags))
>> +       if (!pnfs_layoutcommit_outstanding(inode))
> This might be a problem. If nfsi->flags has !NFS_INO_LAYOUTCOMMIT and
> NFS_INO_LAYOUTCOMMITTING, client cannot issue a new layoutcommit after
> the inflight one finishes. It might not be an issue for file layout as
> long as we only use layoutcommit to update time, but it can cause data
> corruption for block layout.

I don’t understand.

With the new patch, if _either_ NFS_INO_LAYOUTCOMMIT or NFS_INO_LAYOUTCOMMITTING are set, then the client will wait until NFS_INO_LAYOUTCOMMITTING can be locked, it will test for NFS_INO_LAYOUTCOMMIT, and then either issue a new layout commit or exit. How can that cause new breakage for blocks?

The only issues that I’m aware of with the blocks layout and LAYOUTCOMMIT today are:
1. encode_pnfs_block_layoutupdate() runs out of XDR buffer space after 4-5 iterations in the list_for_each_entry_safe() loop. That is because nobody has yet added support for preallocating a page buffer to store the (potentially very large) array of extents. BTW: that array looks like a perfect candidate for xdr_encode_array2() if we could teach the latter about xdr_stream...
2. the blocks layout also needs to be able handle the case where the list of extents is so large that a single LAYOUTCOMMIT is not sufficient. There is no reason why it should not be able to send multiple LAYOUTCOMMIT rpc calls when the size exceeds the session forward channel's negotiated max_rqst_sz.

--
Trond Myklebust
Linux NFS client maintainer


  reply	other threads:[~2014-01-16 17:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13  7:55 [PATCH] nfs: don't update isize when NFS_INO_LAYOUTCOMMITTING in nfs_update_inode shaobingqing
2014-01-13 13:34 ` Trond Myklebust
2014-01-13 16:28   ` Trond Myklebust
2014-01-13 18:45     ` [PATCH 1/2] NFSv4.1: Don't trust attributes if a pNFS LAYOUTCOMMIT is outstanding Trond Myklebust
2014-01-13 18:45     ` [PATCH 2/2] NFSv4.1: Fix a race in nfs4_write_inode Trond Myklebust
2014-01-16 15:49       ` Peng Tao
2014-01-16 17:11         ` Trond Myklebust [this message]
2014-01-17 13:05           ` Peng Tao

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=C6749CD6-1F47-42C5-8E27-A11167BF69E4@primarydata.com \
    --to=trond.myklebust@primarydata.com \
    --cc=bergwolf@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=shaobingqing@bwstor.com.cn \
    /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