Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-15 Thread zhangyi (F)
on 2017/1/11 23:34, Theodore Ts'o wrote: > On Wed, Jan 11, 2017 at 05:07:29PM +0800, zhangyi (F) wrote: >> >> (1) The file we want to unlink have many hard links, but only one dcache >> entry in memory. >> (2) open this file, but it's inode->i_nlink read from disk was 1 (too low). >> (3) some

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-15 Thread zhangyi (F)
on 2017/1/11 23:34, Theodore Ts'o wrote: > On Wed, Jan 11, 2017 at 05:07:29PM +0800, zhangyi (F) wrote: >> >> (1) The file we want to unlink have many hard links, but only one dcache >> entry in memory. >> (2) open this file, but it's inode->i_nlink read from disk was 1 (too low). >> (3) some

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-13 Thread Theodore Ts'o
On Fri, Jan 13, 2017 at 03:42:19AM +, Al Viro wrote: > On Thu, Jan 12, 2017 at 12:03:28PM -0500, Theodore Ts'o wrote: > > On Thu, Jan 12, 2017 at 04:00:16PM +0800, zhangyi (F) wrote: > > > > > > At the same time, I think other file systems may have the same problem, do > > > you think we

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-13 Thread Theodore Ts'o
On Fri, Jan 13, 2017 at 03:42:19AM +, Al Viro wrote: > On Thu, Jan 12, 2017 at 12:03:28PM -0500, Theodore Ts'o wrote: > > On Thu, Jan 12, 2017 at 04:00:16PM +0800, zhangyi (F) wrote: > > > > > > At the same time, I think other file systems may have the same problem, do > > > you think we

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-12 Thread Al Viro
On Thu, Jan 12, 2017 at 12:03:28PM -0500, Theodore Ts'o wrote: > On Thu, Jan 12, 2017 at 04:00:16PM +0800, zhangyi (F) wrote: > > > > At the same time, I think other file systems may have the same problem, do > > you think we should put these detections on the VFS layer? Thus other file > >

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-12 Thread Al Viro
On Thu, Jan 12, 2017 at 12:03:28PM -0500, Theodore Ts'o wrote: > On Thu, Jan 12, 2017 at 04:00:16PM +0800, zhangyi (F) wrote: > > > > At the same time, I think other file systems may have the same problem, do > > you think we should put these detections on the VFS layer? Thus other file > >

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-12 Thread Theodore Ts'o
On Thu, Jan 12, 2017 at 04:00:16PM +0800, zhangyi (F) wrote: > > At the same time, I think other file systems may have the same problem, do > you think we should put these detections on the VFS layer? Thus other file > systems no need to do the same things, but the disadvantage is that we can >

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-12 Thread Theodore Ts'o
On Thu, Jan 12, 2017 at 04:00:16PM +0800, zhangyi (F) wrote: > > At the same time, I think other file systems may have the same problem, do > you think we should put these detections on the VFS layer? Thus other file > systems no need to do the same things, but the disadvantage is that we can >

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-12 Thread zhangyi (F)
on 2017/1/11 23:34, Theodore Ts'o wrote: > On Wed, Jan 11, 2017 at 05:07:29PM +0800, zhangyi (F) wrote: >> >> (1) The file we want to unlink have many hard links, but only one dcache >> entry in memory. >> (2) open this file, but it's inode->i_nlink read from disk was 1 (too low). >> (3) some

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-12 Thread zhangyi (F)
on 2017/1/11 23:34, Theodore Ts'o wrote: > On Wed, Jan 11, 2017 at 05:07:29PM +0800, zhangyi (F) wrote: >> >> (1) The file we want to unlink have many hard links, but only one dcache >> entry in memory. >> (2) open this file, but it's inode->i_nlink read from disk was 1 (too low). >> (3) some

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-11 Thread Theodore Ts'o
On Wed, Jan 11, 2017 at 05:07:29PM +0800, zhangyi (F) wrote: > > (1) The file we want to unlink have many hard links, but only one dcache > entry in memory. > (2) open this file, but it's inode->i_nlink read from disk was 1 (too low). > (3) some one call rename and drop it's i_nlink to zero. >

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-11 Thread Theodore Ts'o
On Wed, Jan 11, 2017 at 05:07:29PM +0800, zhangyi (F) wrote: > > (1) The file we want to unlink have many hard links, but only one dcache > entry in memory. > (2) open this file, but it's inode->i_nlink read from disk was 1 (too low). > (3) some one call rename and drop it's i_nlink to zero. >

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-11 Thread zhangyi (F)
on 2017/1/5 7:35, Theodore Ts'o wrote: > On Wed, Jan 04, 2017 at 01:54:24PM -0800, Darrick J. Wong wrote: >> >> if (inode->i_nlink == 0) { >> ext4_warning_inode(inode, "nlink is already 0"); >> return; >> } > > We can't do that because the place where Zhangyi is proposing to > change

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-11 Thread zhangyi (F)
on 2017/1/5 7:35, Theodore Ts'o wrote: > On Wed, Jan 04, 2017 at 01:54:24PM -0800, Darrick J. Wong wrote: >> >> if (inode->i_nlink == 0) { >> ext4_warning_inode(inode, "nlink is already 0"); >> return; >> } > > We can't do that because the place where Zhangyi is proposing to > change

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-05 Thread Darrick J. Wong
On Thu, Jan 05, 2017 at 03:24:14PM +0800, zhangyi (F) wrote: > > On 2017/1/5 7:35, Theodore Ts'o wrote: > > > > So how exactly how did we get into this state? When we read the inode > > into memory, if i_nlink is zero, we declare the file system as > > corrupted immediately. > > > > So I

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-05 Thread Darrick J. Wong
On Thu, Jan 05, 2017 at 03:24:14PM +0800, zhangyi (F) wrote: > > On 2017/1/5 7:35, Theodore Ts'o wrote: > > > > So how exactly how did we get into this state? When we read the inode > > into memory, if i_nlink is zero, we declare the file system as > > corrupted immediately. > > > > So I

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-04 Thread zhangyi (F)
On 2017/1/5 7:35, Theodore Ts'o wrote: > > So how exactly how did we get into this state? When we read the inode > into memory, if i_nlink is zero, we declare the file system as > corrupted immediately. > > So I assume this is happening the on-disk i_links_count (which is read > into

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-04 Thread zhangyi (F)
On 2017/1/5 7:35, Theodore Ts'o wrote: > > So how exactly how did we get into this state? When we read the inode > into memory, if i_nlink is zero, we declare the file system as > corrupted immediately. > > So I assume this is happening the on-disk i_links_count (which is read > into

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-04 Thread Theodore Ts'o
On Wed, Jan 04, 2017 at 01:54:24PM -0800, Darrick J. Wong wrote: > > if (inode->i_nlink == 0) { > ext4_warning_inode(inode, "nlink is already 0"); > return; > } We can't do that because the place where Zhangyi is proposing to change is in fs/inode.c:drop_nlink(), so we can't add a

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-04 Thread Theodore Ts'o
On Wed, Jan 04, 2017 at 01:54:24PM -0800, Darrick J. Wong wrote: > > if (inode->i_nlink == 0) { > ext4_warning_inode(inode, "nlink is already 0"); > return; > } We can't do that because the place where Zhangyi is proposing to change is in fs/inode.c:drop_nlink(), so we can't add a

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-04 Thread Darrick J. Wong
On Wed, Jan 04, 2017 at 04:29:33PM +0800, zhangyi (F) wrote: > On 2017/1/1 6:59, valdis.kletni...@vt.edu said: > > On Mon, 26 Dec 2016 20:34:17 +0800, yi zhang said: > >> Because of the disk and hardware issue, the ext4 filesystem have > >> many errors, the inode->i_nlink of ext4 becomes zero

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-04 Thread Darrick J. Wong
On Wed, Jan 04, 2017 at 04:29:33PM +0800, zhangyi (F) wrote: > On 2017/1/1 6:59, valdis.kletni...@vt.edu said: > > On Mon, 26 Dec 2016 20:34:17 +0800, yi zhang said: > >> Because of the disk and hardware issue, the ext4 filesystem have > >> many errors, the inode->i_nlink of ext4 becomes zero

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-04 Thread Andreas Dilger
On Jan 4, 2017, at 2:54 PM, Darrick J. Wong wrote: > > On Wed, Jan 04, 2017 at 04:29:33PM +0800, zhangyi (F) wrote: >> On 2017/1/1 6:59, valdis.kletni...@vt.edu said: >>> On Mon, 26 Dec 2016 20:34:17 +0800, yi zhang said: Because of the disk and hardware issue, the

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-04 Thread Andreas Dilger
On Jan 4, 2017, at 2:54 PM, Darrick J. Wong wrote: > > On Wed, Jan 04, 2017 at 04:29:33PM +0800, zhangyi (F) wrote: >> On 2017/1/1 6:59, valdis.kletni...@vt.edu said: >>> On Mon, 26 Dec 2016 20:34:17 +0800, yi zhang said: Because of the disk and hardware issue, the ext4 filesystem have

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-04 Thread zhangyi (F)
On 2017/1/1 6:59, valdis.kletni...@vt.edu said: > On Mon, 26 Dec 2016 20:34:17 +0800, yi zhang said: >> Because of the disk and hardware issue, the ext4 filesystem have >> many errors, the inode->i_nlink of ext4 becomes zero abnormally >> but the dentry is still positive, it will cause memory

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2017-01-04 Thread zhangyi (F)
On 2017/1/1 6:59, valdis.kletni...@vt.edu said: > On Mon, 26 Dec 2016 20:34:17 +0800, yi zhang said: >> Because of the disk and hardware issue, the ext4 filesystem have >> many errors, the inode->i_nlink of ext4 becomes zero abnormally >> but the dentry is still positive, it will cause memory

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2016-12-31 Thread Valdis . Kletnieks
On Mon, 26 Dec 2016 20:34:17 +0800, yi zhang said: > Because of the disk and hardware issue, the ext4 filesystem have > many errors, the inode->i_nlink of ext4 becomes zero abnormally > but the dentry is still positive, it will cause memory corruption > after the following process: > > 1) Due to

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2016-12-31 Thread Valdis . Kletnieks
On Mon, 26 Dec 2016 20:34:17 +0800, yi zhang said: > Because of the disk and hardware issue, the ext4 filesystem have > many errors, the inode->i_nlink of ext4 becomes zero abnormally > but the dentry is still positive, it will cause memory corruption > after the following process: > > 1) Due to

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2016-12-26 Thread Andreas Dilger
On Dec 26, 2016, at 5:34 AM, yi zhang wrote: > > Because of the disk and hardware issue, the ext4 filesystem have > many errors, the inode->i_nlink of ext4 becomes zero abnormally > but the dentry is still positive, it will cause memory corruption > after the following

Re: [RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2016-12-26 Thread Andreas Dilger
On Dec 26, 2016, at 5:34 AM, yi zhang wrote: > > Because of the disk and hardware issue, the ext4 filesystem have > many errors, the inode->i_nlink of ext4 becomes zero abnormally > but the dentry is still positive, it will cause memory corruption > after the following process: > > 1) Due to

[RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2016-12-26 Thread yi zhang
Because of the disk and hardware issue, the ext4 filesystem have many errors, the inode->i_nlink of ext4 becomes zero abnormally but the dentry is still positive, it will cause memory corruption after the following process: 1) Due to the inode->i_nlink is 0, this inode will be added into the

[RFC PATCH] ext4: increase the protection of drop nlink and ext4 inode destroy

2016-12-26 Thread yi zhang
Because of the disk and hardware issue, the ext4 filesystem have many errors, the inode->i_nlink of ext4 becomes zero abnormally but the dentry is still positive, it will cause memory corruption after the following process: 1) Due to the inode->i_nlink is 0, this inode will be added into the