linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vitaliy Gusev <gusev.vitaliy@nexenta.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Vitaliy Gusev <gusev.vitaliy@gmail.com>,
	peng_tao@emc.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfs: fix inifinite loop at nfs4_layoutcommit_release
Date: Wed, 07 Sep 2011 02:13:53 +0400	[thread overview]
Message-ID: <4E669B21.30006@nexenta.com> (raw)
In-Reply-To: <1315337382.16274.7.camel@lade.trondhjem.org>

>> @@ -1376,7 +1376,8 @@ static void pnfs_list_write_lseg(struct inode *inode, struct list_head *listp)
>>
>>   	list_for_each_entry(lseg,&NFS_I(inode)->layout->plh_segs, pls_list) {
>>   		if (lseg->pls_range.iomode == IOMODE_RW&&
>> -		    test_bit(NFS_LSEG_LAYOUTCOMMIT,&lseg->pls_flags))
>> +		    test_bit(NFS_LSEG_LAYOUTCOMMIT,&lseg->pls_flags)&&
>> +		    list_empty(&lseg->pls_lc_list))
>>   			list_add(&lseg->pls_lc_list, listp);
>>   	}
>>   }
>
> If the lseg is already part of one layoutcommit, but we're sending a
> second one for the same range (presumably because we wrote more data in
> the same region), then the above causes the lseg to be excluded.


Yes, lseg is excluded, This patch does exactly only exclusion of lseg. 
lseg is used here only to get/put reference on this lseg, so skipping is 
correct.


However, checking on list_empty can occur (on other CPU) in the middle:

	list_del_init(&lseg->pls_lc_list);
Here >>>>>>
	if (test_and_clear_bit(NFS_LSEG_LAYOUTCOMMIT,
			       &lseg->pls_flags))
		put_lseg(lseg);


So list_del_init must be executed under the same lock as 
pnfs_list_write_lseg, i.e. inode->i_lock.


>
> I agree that the current code causes list corruption, but before
> applying something like the above patch, I'd like to understand why it
> is correct.
>
> Trond
>


  reply	other threads:[~2011-09-06 22:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-28  6:22 [PATCH] nfs: fix inifinite loop at nfs4_layoutcommit_release Vitaliy Gusev
2011-09-06 19:29 ` Trond Myklebust
2011-09-06 22:13   ` Vitaliy Gusev [this message]
2011-09-06 22:32     ` Trond Myklebust
2011-09-08 10:21       ` tao.peng
2011-09-08 12:01         ` Myklebust, Trond
2011-09-08 15:00           ` Peng Tao
2011-09-08 17:05             ` Myklebust, Trond
2011-09-09  3:11               ` tao.peng
2011-09-09 18:20                 ` Trond Myklebust
2011-09-10  7:14                   ` Benny Halevy
2011-09-12 14:56                     ` Peng Tao
2011-09-12 20:31                       ` Benny Halevy
2011-09-12 21:10                         ` Trond Myklebust
2011-09-13  7:50                           ` Benny Halevy
2011-09-13  8:32                             ` tao.peng
2011-09-14  6:43                               ` Benny Halevy
2011-09-14  7:53                                 ` tao.peng
     [not found]                                   ` <F19688880B763E40B28B2B462677FBF805C3F7A911-AYrsSIZi/B2B3McK65YKY9BPR1lH4CV8@public.gmane.org>
2011-09-14 13:20                                     ` Benny Halevy
2011-09-13  8:09                           ` tao.peng
2011-09-14  6:46                             ` Benny Halevy
2011-09-13  7:02                         ` tao.peng
2011-09-13  7:54                           ` Benny Halevy
2011-09-12 14:48                   ` Peng Tao
2011-09-08 10:00     ` tao.peng
2011-09-08 13:02       ` Vitaliy Gusev
2011-09-08 15:09         ` Peng Tao
2011-09-09 17:46           ` Vitaliy Gusev
2011-09-12 14:42             ` 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=4E669B21.30006@nexenta.com \
    --to=gusev.vitaliy@nexenta.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=gusev.vitaliy@gmail.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=peng_tao@emc.com \
    /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;
as well as URLs for NNTP newsgroup(s).