All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: handle quota for orphan inodes
@ 2018-02-10  2:28 ` Jaegeuk Kim
  0 siblings, 0 replies; 9+ messages in thread
From: Jaegeuk Kim @ 2018-02-10  2:28 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim

This is to fix missing dquot_initialize for orphan inodes.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 8b0945ba284d..e3bf753a47be 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
 	struct node_info ni;
 	int err = acquire_orphan_inode(sbi);
 
-	if (err) {
-		set_sbi_flag(sbi, SBI_NEED_FSCK);
-		f2fs_msg(sbi->sb, KERN_WARNING,
-				"%s: orphan failed (ino=%x), run fsck to fix.",
-				__func__, ino);
-		return err;
-	}
+	if (err)
+		goto err_out;
 
 	__add_ino_entry(sbi, ino, 0, ORPHAN_INO);
 
@@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
 		return PTR_ERR(inode);
 	}
 
+	err = dquot_initialize(inode);
+	if (err)
+		goto err_out;
+
+	dquot_initialize(inode);
 	clear_nlink(inode);
 
 	/* truncate all the data during iput */
@@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
 
 	/* ENOMEM was fully retried in f2fs_evict_inode. */
 	if (ni.blk_addr != NULL_ADDR) {
-		set_sbi_flag(sbi, SBI_NEED_FSCK);
-		f2fs_msg(sbi->sb, KERN_WARNING,
-			"%s: orphan failed (ino=%x) by kernel, retry mount.",
-				__func__, ino);
-		return -EIO;
+		err = -EIO;
+		goto err_out;
 	}
 	__remove_ino_entry(sbi, ino, ORPHAN_INO);
 	return 0;
+
+err_out:
+	set_sbi_flag(sbi, SBI_NEED_FSCK);
+	f2fs_msg(sbi->sb, KERN_WARNING,
+			"%s: orphan failed (ino=%x), run fsck to fix.",
+			__func__, ino);
+	return err;
 }
 
 int recover_orphan_inodes(struct f2fs_sb_info *sbi)
-- 
2.15.0.531.g2ccb3012c9-goog

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] f2fs: handle quota for orphan inodes
@ 2018-02-10  2:28 ` Jaegeuk Kim
  0 siblings, 0 replies; 9+ messages in thread
From: Jaegeuk Kim @ 2018-02-10  2:28 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim

This is to fix missing dquot_initialize for orphan inodes.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 8b0945ba284d..e3bf753a47be 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
 	struct node_info ni;
 	int err = acquire_orphan_inode(sbi);
 
-	if (err) {
-		set_sbi_flag(sbi, SBI_NEED_FSCK);
-		f2fs_msg(sbi->sb, KERN_WARNING,
-				"%s: orphan failed (ino=%x), run fsck to fix.",
-				__func__, ino);
-		return err;
-	}
+	if (err)
+		goto err_out;
 
 	__add_ino_entry(sbi, ino, 0, ORPHAN_INO);
 
@@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
 		return PTR_ERR(inode);
 	}
 
+	err = dquot_initialize(inode);
+	if (err)
+		goto err_out;
+
+	dquot_initialize(inode);
 	clear_nlink(inode);
 
 	/* truncate all the data during iput */
@@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
 
 	/* ENOMEM was fully retried in f2fs_evict_inode. */
 	if (ni.blk_addr != NULL_ADDR) {
-		set_sbi_flag(sbi, SBI_NEED_FSCK);
-		f2fs_msg(sbi->sb, KERN_WARNING,
-			"%s: orphan failed (ino=%x) by kernel, retry mount.",
-				__func__, ino);
-		return -EIO;
+		err = -EIO;
+		goto err_out;
 	}
 	__remove_ino_entry(sbi, ino, ORPHAN_INO);
 	return 0;
+
+err_out:
+	set_sbi_flag(sbi, SBI_NEED_FSCK);
+	f2fs_msg(sbi->sb, KERN_WARNING,
+			"%s: orphan failed (ino=%x), run fsck to fix.",
+			__func__, ino);
+	return err;
 }
 
 int recover_orphan_inodes(struct f2fs_sb_info *sbi)
-- 
2.15.0.531.g2ccb3012c9-goog


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: handle quota for orphan inodes
  2018-02-10  2:28 ` Jaegeuk Kim
@ 2018-02-13 14:33   ` Chao Yu
  -1 siblings, 0 replies; 9+ messages in thread
From: Chao Yu @ 2018-02-13 14:33 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2018/2/10 10:28, Jaegeuk Kim wrote:
> This is to fix missing dquot_initialize for orphan inodes.

IMO, we don't need to call dquot_initialize as we have call the function
in evict(), right?

Thanks,

> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------
>  1 file changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> index 8b0945ba284d..e3bf753a47be 100644
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>  	struct node_info ni;
>  	int err = acquire_orphan_inode(sbi);
>  
> -	if (err) {
> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
> -		f2fs_msg(sbi->sb, KERN_WARNING,
> -				"%s: orphan failed (ino=%x), run fsck to fix.",
> -				__func__, ino);
> -		return err;
> -	}
> +	if (err)
> +		goto err_out;
>  
>  	__add_ino_entry(sbi, ino, 0, ORPHAN_INO);
>  
> @@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>  		return PTR_ERR(inode);
>  	}
>  
> +	err = dquot_initialize(inode);
> +	if (err)
> +		goto err_out;
> +
> +	dquot_initialize(inode);
>  	clear_nlink(inode);
>  
>  	/* truncate all the data during iput */
> @@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>  
>  	/* ENOMEM was fully retried in f2fs_evict_inode. */
>  	if (ni.blk_addr != NULL_ADDR) {
> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
> -		f2fs_msg(sbi->sb, KERN_WARNING,
> -			"%s: orphan failed (ino=%x) by kernel, retry mount.",
> -				__func__, ino);
> -		return -EIO;
> +		err = -EIO;
> +		goto err_out;
>  	}
>  	__remove_ino_entry(sbi, ino, ORPHAN_INO);
>  	return 0;
> +
> +err_out:
> +	set_sbi_flag(sbi, SBI_NEED_FSCK);
> +	f2fs_msg(sbi->sb, KERN_WARNING,
> +			"%s: orphan failed (ino=%x), run fsck to fix.",
> +			__func__, ino);
> +	return err;
>  }
>  
>  int recover_orphan_inodes(struct f2fs_sb_info *sbi)
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] f2fs: handle quota for orphan inodes
@ 2018-02-13 14:33   ` Chao Yu
  0 siblings, 0 replies; 9+ messages in thread
From: Chao Yu @ 2018-02-13 14:33 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2018/2/10 10:28, Jaegeuk Kim wrote:
> This is to fix missing dquot_initialize for orphan inodes.

IMO, we don't need to call dquot_initialize as we have call the function
in evict(), right?

Thanks,

> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------
>  1 file changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> index 8b0945ba284d..e3bf753a47be 100644
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>  	struct node_info ni;
>  	int err = acquire_orphan_inode(sbi);
>  
> -	if (err) {
> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
> -		f2fs_msg(sbi->sb, KERN_WARNING,
> -				"%s: orphan failed (ino=%x), run fsck to fix.",
> -				__func__, ino);
> -		return err;
> -	}
> +	if (err)
> +		goto err_out;
>  
>  	__add_ino_entry(sbi, ino, 0, ORPHAN_INO);
>  
> @@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>  		return PTR_ERR(inode);
>  	}
>  
> +	err = dquot_initialize(inode);
> +	if (err)
> +		goto err_out;
> +
> +	dquot_initialize(inode);
>  	clear_nlink(inode);
>  
>  	/* truncate all the data during iput */
> @@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>  
>  	/* ENOMEM was fully retried in f2fs_evict_inode. */
>  	if (ni.blk_addr != NULL_ADDR) {
> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
> -		f2fs_msg(sbi->sb, KERN_WARNING,
> -			"%s: orphan failed (ino=%x) by kernel, retry mount.",
> -				__func__, ino);
> -		return -EIO;
> +		err = -EIO;
> +		goto err_out;
>  	}
>  	__remove_ino_entry(sbi, ino, ORPHAN_INO);
>  	return 0;
> +
> +err_out:
> +	set_sbi_flag(sbi, SBI_NEED_FSCK);
> +	f2fs_msg(sbi->sb, KERN_WARNING,
> +			"%s: orphan failed (ino=%x), run fsck to fix.",
> +			__func__, ino);
> +	return err;
>  }
>  
>  int recover_orphan_inodes(struct f2fs_sb_info *sbi)
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: handle quota for orphan inodes
  2018-02-13 14:33   ` Chao Yu
@ 2018-02-27 10:46     ` Chao Yu
  -1 siblings, 0 replies; 9+ messages in thread
From: Chao Yu @ 2018-02-27 10:46 UTC (permalink / raw)
  To: Chao Yu, Jaegeuk Kim, linux-kernel, linux-f2fs-devel

Ping,

On 2018/2/13 22:33, Chao Yu wrote:
> On 2018/2/10 10:28, Jaegeuk Kim wrote:
>> This is to fix missing dquot_initialize for orphan inodes.
> 
> IMO, we don't need to call dquot_initialize as we have call the function
> in evict(), right?
> 
> Thanks,
> 
>>
>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>> ---
>>  fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------
>>  1 file changed, 16 insertions(+), 12 deletions(-)
>>
>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>> index 8b0945ba284d..e3bf753a47be 100644
>> --- a/fs/f2fs/checkpoint.c
>> +++ b/fs/f2fs/checkpoint.c
>> @@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>>  	struct node_info ni;
>>  	int err = acquire_orphan_inode(sbi);
>>  
>> -	if (err) {
>> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
>> -		f2fs_msg(sbi->sb, KERN_WARNING,
>> -				"%s: orphan failed (ino=%x), run fsck to fix.",
>> -				__func__, ino);
>> -		return err;
>> -	}
>> +	if (err)
>> +		goto err_out;
>>  
>>  	__add_ino_entry(sbi, ino, 0, ORPHAN_INO);
>>  
>> @@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>>  		return PTR_ERR(inode);
>>  	}
>>  
>> +	err = dquot_initialize(inode);
>> +	if (err)
>> +		goto err_out;
>> +
>> +	dquot_initialize(inode);
>>  	clear_nlink(inode);
>>  
>>  	/* truncate all the data during iput */
>> @@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>>  
>>  	/* ENOMEM was fully retried in f2fs_evict_inode. */
>>  	if (ni.blk_addr != NULL_ADDR) {
>> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
>> -		f2fs_msg(sbi->sb, KERN_WARNING,
>> -			"%s: orphan failed (ino=%x) by kernel, retry mount.",
>> -				__func__, ino);
>> -		return -EIO;
>> +		err = -EIO;
>> +		goto err_out;
>>  	}
>>  	__remove_ino_entry(sbi, ino, ORPHAN_INO);
>>  	return 0;
>> +
>> +err_out:
>> +	set_sbi_flag(sbi, SBI_NEED_FSCK);
>> +	f2fs_msg(sbi->sb, KERN_WARNING,
>> +			"%s: orphan failed (ino=%x), run fsck to fix.",
>> +			__func__, ino);
>> +	return err;
>>  }
>>  
>>  int recover_orphan_inodes(struct f2fs_sb_info *sbi)
>>
> 
> .
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: handle quota for orphan inodes
@ 2018-02-27 10:46     ` Chao Yu
  0 siblings, 0 replies; 9+ messages in thread
From: Chao Yu @ 2018-02-27 10:46 UTC (permalink / raw)
  To: Chao Yu, Jaegeuk Kim, linux-kernel, linux-f2fs-devel

Ping,

On 2018/2/13 22:33, Chao Yu wrote:
> On 2018/2/10 10:28, Jaegeuk Kim wrote:
>> This is to fix missing dquot_initialize for orphan inodes.
> 
> IMO, we don't need to call dquot_initialize as we have call the function
> in evict(), right?
> 
> Thanks,
> 
>>
>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>> ---
>>  fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------
>>  1 file changed, 16 insertions(+), 12 deletions(-)
>>
>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>> index 8b0945ba284d..e3bf753a47be 100644
>> --- a/fs/f2fs/checkpoint.c
>> +++ b/fs/f2fs/checkpoint.c
>> @@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>>  	struct node_info ni;
>>  	int err = acquire_orphan_inode(sbi);
>>  
>> -	if (err) {
>> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
>> -		f2fs_msg(sbi->sb, KERN_WARNING,
>> -				"%s: orphan failed (ino=%x), run fsck to fix.",
>> -				__func__, ino);
>> -		return err;
>> -	}
>> +	if (err)
>> +		goto err_out;
>>  
>>  	__add_ino_entry(sbi, ino, 0, ORPHAN_INO);
>>  
>> @@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>>  		return PTR_ERR(inode);
>>  	}
>>  
>> +	err = dquot_initialize(inode);
>> +	if (err)
>> +		goto err_out;
>> +
>> +	dquot_initialize(inode);
>>  	clear_nlink(inode);
>>  
>>  	/* truncate all the data during iput */
>> @@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>>  
>>  	/* ENOMEM was fully retried in f2fs_evict_inode. */
>>  	if (ni.blk_addr != NULL_ADDR) {
>> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
>> -		f2fs_msg(sbi->sb, KERN_WARNING,
>> -			"%s: orphan failed (ino=%x) by kernel, retry mount.",
>> -				__func__, ino);
>> -		return -EIO;
>> +		err = -EIO;
>> +		goto err_out;
>>  	}
>>  	__remove_ino_entry(sbi, ino, ORPHAN_INO);
>>  	return 0;
>> +
>> +err_out:
>> +	set_sbi_flag(sbi, SBI_NEED_FSCK);
>> +	f2fs_msg(sbi->sb, KERN_WARNING,
>> +			"%s: orphan failed (ino=%x), run fsck to fix.",
>> +			__func__, ino);
>> +	return err;
>>  }
>>  
>>  int recover_orphan_inodes(struct f2fs_sb_info *sbi)
>>
> 
> .
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: handle quota for orphan inodes
  2018-02-27 10:46     ` Chao Yu
  (?)
@ 2018-02-28  5:23     ` Jaegeuk Kim
  2018-02-28  9:37         ` Chao Yu
  -1 siblings, 1 reply; 9+ messages in thread
From: Jaegeuk Kim @ 2018-02-28  5:23 UTC (permalink / raw)
  To: Chao Yu; +Cc: Chao Yu, linux-kernel, linux-f2fs-devel

On 02/27, Chao Yu wrote:
> Ping,
> 
> On 2018/2/13 22:33, Chao Yu wrote:
> > On 2018/2/10 10:28, Jaegeuk Kim wrote:
> >> This is to fix missing dquot_initialize for orphan inodes.
> > 
> > IMO, we don't need to call dquot_initialize as we have call the function
> > in evict(), right?

I think we'd better detect any error in early stage.

Thanks,

> > 
> > Thanks,
> > 
> >>
> >> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >> ---
> >>  fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------
> >>  1 file changed, 16 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> >> index 8b0945ba284d..e3bf753a47be 100644
> >> --- a/fs/f2fs/checkpoint.c
> >> +++ b/fs/f2fs/checkpoint.c
> >> @@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
> >>  	struct node_info ni;
> >>  	int err = acquire_orphan_inode(sbi);
> >>  
> >> -	if (err) {
> >> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
> >> -		f2fs_msg(sbi->sb, KERN_WARNING,
> >> -				"%s: orphan failed (ino=%x), run fsck to fix.",
> >> -				__func__, ino);
> >> -		return err;
> >> -	}
> >> +	if (err)
> >> +		goto err_out;
> >>  
> >>  	__add_ino_entry(sbi, ino, 0, ORPHAN_INO);
> >>  
> >> @@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
> >>  		return PTR_ERR(inode);
> >>  	}
> >>  
> >> +	err = dquot_initialize(inode);
> >> +	if (err)
> >> +		goto err_out;
> >> +
> >> +	dquot_initialize(inode);
> >>  	clear_nlink(inode);
> >>  
> >>  	/* truncate all the data during iput */
> >> @@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
> >>  
> >>  	/* ENOMEM was fully retried in f2fs_evict_inode. */
> >>  	if (ni.blk_addr != NULL_ADDR) {
> >> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
> >> -		f2fs_msg(sbi->sb, KERN_WARNING,
> >> -			"%s: orphan failed (ino=%x) by kernel, retry mount.",
> >> -				__func__, ino);
> >> -		return -EIO;
> >> +		err = -EIO;
> >> +		goto err_out;
> >>  	}
> >>  	__remove_ino_entry(sbi, ino, ORPHAN_INO);
> >>  	return 0;
> >> +
> >> +err_out:
> >> +	set_sbi_flag(sbi, SBI_NEED_FSCK);
> >> +	f2fs_msg(sbi->sb, KERN_WARNING,
> >> +			"%s: orphan failed (ino=%x), run fsck to fix.",
> >> +			__func__, ino);
> >> +	return err;
> >>  }
> >>  
> >>  int recover_orphan_inodes(struct f2fs_sb_info *sbi)
> >>
> > 
> > .
> > 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: handle quota for orphan inodes
  2018-02-28  5:23     ` Jaegeuk Kim
@ 2018-02-28  9:37         ` Chao Yu
  0 siblings, 0 replies; 9+ messages in thread
From: Chao Yu @ 2018-02-28  9:37 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: Chao Yu, linux-kernel, linux-f2fs-devel

On 2018/2/28 13:23, Jaegeuk Kim wrote:
> On 02/27, Chao Yu wrote:
>> Ping,
>>
>> On 2018/2/13 22:33, Chao Yu wrote:
>>> On 2018/2/10 10:28, Jaegeuk Kim wrote:
>>>> This is to fix missing dquot_initialize for orphan inodes.
>>>
>>> IMO, we don't need to call dquot_initialize as we have call the function
>>> in evict(), right?
> 
> I think we'd better detect any error in early stage.

Oh, agreed, in evict(), we can not detect or handle the error of
dquot_initialize, how about changing commit log a bit to indicate that, anyway,
the change looks good to me. ;)

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

> 
> Thanks,
> 
>>>
>>> Thanks,
>>>
>>>>
>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>>> ---
>>>>  fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------
>>>>  1 file changed, 16 insertions(+), 12 deletions(-)
>>>>
>>>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>>>> index 8b0945ba284d..e3bf753a47be 100644
>>>> --- a/fs/f2fs/checkpoint.c
>>>> +++ b/fs/f2fs/checkpoint.c
>>>> @@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>>>>  	struct node_info ni;
>>>>  	int err = acquire_orphan_inode(sbi);
>>>>  
>>>> -	if (err) {
>>>> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>> -		f2fs_msg(sbi->sb, KERN_WARNING,
>>>> -				"%s: orphan failed (ino=%x), run fsck to fix.",
>>>> -				__func__, ino);
>>>> -		return err;
>>>> -	}
>>>> +	if (err)
>>>> +		goto err_out;
>>>>  
>>>>  	__add_ino_entry(sbi, ino, 0, ORPHAN_INO);
>>>>  
>>>> @@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>>>>  		return PTR_ERR(inode);
>>>>  	}
>>>>  
>>>> +	err = dquot_initialize(inode);
>>>> +	if (err)
>>>> +		goto err_out;
>>>> +
>>>> +	dquot_initialize(inode);
>>>>  	clear_nlink(inode);
>>>>  
>>>>  	/* truncate all the data during iput */
>>>> @@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>>>>  
>>>>  	/* ENOMEM was fully retried in f2fs_evict_inode. */
>>>>  	if (ni.blk_addr != NULL_ADDR) {
>>>> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>> -		f2fs_msg(sbi->sb, KERN_WARNING,
>>>> -			"%s: orphan failed (ino=%x) by kernel, retry mount.",
>>>> -				__func__, ino);
>>>> -		return -EIO;
>>>> +		err = -EIO;
>>>> +		goto err_out;
>>>>  	}
>>>>  	__remove_ino_entry(sbi, ino, ORPHAN_INO);
>>>>  	return 0;
>>>> +
>>>> +err_out:
>>>> +	set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>> +	f2fs_msg(sbi->sb, KERN_WARNING,
>>>> +			"%s: orphan failed (ino=%x), run fsck to fix.",
>>>> +			__func__, ino);
>>>> +	return err;
>>>>  }
>>>>  
>>>>  int recover_orphan_inodes(struct f2fs_sb_info *sbi)
>>>>
>>>
>>> .
>>>
> 
> .
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: handle quota for orphan inodes
@ 2018-02-28  9:37         ` Chao Yu
  0 siblings, 0 replies; 9+ messages in thread
From: Chao Yu @ 2018-02-28  9:37 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: Chao Yu, linux-kernel, linux-f2fs-devel

On 2018/2/28 13:23, Jaegeuk Kim wrote:
> On 02/27, Chao Yu wrote:
>> Ping,
>>
>> On 2018/2/13 22:33, Chao Yu wrote:
>>> On 2018/2/10 10:28, Jaegeuk Kim wrote:
>>>> This is to fix missing dquot_initialize for orphan inodes.
>>>
>>> IMO, we don't need to call dquot_initialize as we have call the function
>>> in evict(), right?
> 
> I think we'd better detect any error in early stage.

Oh, agreed, in evict(), we can not detect or handle the error of
dquot_initialize, how about changing commit log a bit to indicate that, anyway,
the change looks good to me. ;)

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

> 
> Thanks,
> 
>>>
>>> Thanks,
>>>
>>>>
>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>>> ---
>>>>  fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------
>>>>  1 file changed, 16 insertions(+), 12 deletions(-)
>>>>
>>>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>>>> index 8b0945ba284d..e3bf753a47be 100644
>>>> --- a/fs/f2fs/checkpoint.c
>>>> +++ b/fs/f2fs/checkpoint.c
>>>> @@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>>>>  	struct node_info ni;
>>>>  	int err = acquire_orphan_inode(sbi);
>>>>  
>>>> -	if (err) {
>>>> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>> -		f2fs_msg(sbi->sb, KERN_WARNING,
>>>> -				"%s: orphan failed (ino=%x), run fsck to fix.",
>>>> -				__func__, ino);
>>>> -		return err;
>>>> -	}
>>>> +	if (err)
>>>> +		goto err_out;
>>>>  
>>>>  	__add_ino_entry(sbi, ino, 0, ORPHAN_INO);
>>>>  
>>>> @@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>>>>  		return PTR_ERR(inode);
>>>>  	}
>>>>  
>>>> +	err = dquot_initialize(inode);
>>>> +	if (err)
>>>> +		goto err_out;
>>>> +
>>>> +	dquot_initialize(inode);
>>>>  	clear_nlink(inode);
>>>>  
>>>>  	/* truncate all the data during iput */
>>>> @@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
>>>>  
>>>>  	/* ENOMEM was fully retried in f2fs_evict_inode. */
>>>>  	if (ni.blk_addr != NULL_ADDR) {
>>>> -		set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>> -		f2fs_msg(sbi->sb, KERN_WARNING,
>>>> -			"%s: orphan failed (ino=%x) by kernel, retry mount.",
>>>> -				__func__, ino);
>>>> -		return -EIO;
>>>> +		err = -EIO;
>>>> +		goto err_out;
>>>>  	}
>>>>  	__remove_ino_entry(sbi, ino, ORPHAN_INO);
>>>>  	return 0;
>>>> +
>>>> +err_out:
>>>> +	set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>> +	f2fs_msg(sbi->sb, KERN_WARNING,
>>>> +			"%s: orphan failed (ino=%x), run fsck to fix.",
>>>> +			__func__, ino);
>>>> +	return err;
>>>>  }
>>>>  
>>>>  int recover_orphan_inodes(struct f2fs_sb_info *sbi)
>>>>
>>>
>>> .
>>>
> 
> .
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-02-28  9:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-10  2:28 [PATCH] f2fs: handle quota for orphan inodes Jaegeuk Kim
2018-02-10  2:28 ` Jaegeuk Kim
2018-02-13 14:33 ` [f2fs-dev] " Chao Yu
2018-02-13 14:33   ` Chao Yu
2018-02-27 10:46   ` [f2fs-dev] " Chao Yu
2018-02-27 10:46     ` Chao Yu
2018-02-28  5:23     ` Jaegeuk Kim
2018-02-28  9:37       ` Chao Yu
2018-02-28  9:37         ` Chao Yu

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.