Linux ocfs2 filesystem development
 help / color / mirror / Atom feed
From: jiangyiwen <jiangyiwen@huawei.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [patch 07/28] ocfs2: fix a tiny case that inode can not removed.
Date: Mon, 31 Aug 2015 15:28:54 +0800	[thread overview]
Message-ID: <55E40236.5020104@huawei.com> (raw)
In-Reply-To: <20150828232632.GL1145@wotan.suse.de>

On 2015/8/29 7:26, Mark Fasheh wrote:
> On Wed, Aug 26, 2015 at 03:11:37PM -0700, Andrew Morton wrote:
>> From: jiangyiwen <jiangyiwen@huawei.com>
>> Subject: ocfs2: fix a tiny case that inode can not removed.
>>
>> When running dirop_fileop_racer we found a case that inode
>> can not removed.
>>
>> 2 nodes, say Node A and Node B, mount the same ocfs2 volume. Create
>> two dirs /race/1/ and /race/2/ in the filesystem.
>>
>> Node A                            Node B
>> rm -r /race/2/
>>                                   mv /race/1/ /race/2/
>> call ocfs2_unlink(), get
>> the EX mode of /race/2/
>>                                   wait for B unlock /race/2/
>> decrease i_nlink of /race/2/ to 0,
>> and add inode of /race/2/ into
>> orphan dir, unlock /race/2/
>>                                   got EX mode of /race/2/. because
>>                                   /race/1/ is dir, so inc i_nlink
>>                                   of /race/2/ and update into disk,
>>                                   unlock /race/2/
>> because i_nlink of /race/2/
>> is not zero, this inode will
>> always remain in orphan dir
>>
>> This patch fixes this case by test whether i_nlink of new dir is zero.
> 
> 
> Good catch, thanks for this.
> 
> 
>> diff -puN fs/ocfs2/namei.c~ocfs2-fix-a-tiny-case-that-inode-can-not-removed fs/ocfs2/namei.c
>> --- a/fs/ocfs2/namei.c~ocfs2-fix-a-tiny-case-that-inode-can-not-removed
>> +++ a/fs/ocfs2/namei.c
>> @@ -1284,6 +1284,15 @@ static int ocfs2_rename(struct inode *ol
>>  	}
>>  	parents_locked = 1;
>>  
>> +	if (!new_dir->i_nlink) {
>> +		mlog(ML_ERROR, "new dir %llu has been removed, inode %llu "
>> +				"can not be moved into it.",
>> +				(unsigned long long)new_dir->i_ino,
>> +				(unsigned long long)old_inode->i_ino);
> 
> This is something that is rare, but not an error or otherwise outstanding
> condition. Therefore printing to the kernel log is not advisable and may
> confuse users. Please turn that into a debug print or remove it all
> together, thanks.
> 	--Mark
> 
> --
> Mark Fasheh
> 
> .
> 
OK, thanks Mark, I will resend a new version immediately.

Thanks,
Yiwen Jiang

      reply	other threads:[~2015-08-31  7:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-26 22:11 [Ocfs2-devel] [patch 07/28] ocfs2: fix a tiny case that inode can not removed akpm at linux-foundation.org
2015-08-28 23:26 ` Mark Fasheh
2015-08-31  7:28   ` jiangyiwen [this message]

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=55E40236.5020104@huawei.com \
    --to=jiangyiwen@huawei.com \
    --cc=ocfs2-devel@oss.oracle.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