lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 5 May 2016 10:00:15 +0800
From:	Hou Pengyang <houpengyang@...wei.com>
To:	Jaegeuk Kim <jaegeuk@...nel.org>
CC:	<linux-kernel@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>,
	<linux-f2fs-devel@...ts.sourceforge.net>,
	wangbintian 00221568 <bintian.wang@...wei.com>
Subject: Re: [f2fs-dev] [PATCH 11/11] f2fs: retry to truncate blocks in -ENOMEM
 case

On 2016/5/4 2:21, Jaegeuk Kim wrote:
> This patch modifies to retry truncating node blocks in -ENOMEM case.
>
Hi, Kim. in this patch, I think there is NO chance to retry for -ENOMEM.

This is because if exist_written_data returns false, we can confirm that
this inode has been released from orphan radix-tree:
f2fs_evict_inode
  ---> remove_inode_page
     ---> truncate_node
         ---> remove_orphan_inode
On this condition, err is 0, So it won't enter:
if (err && err != -ENOENT)
{
     ...
}
sequentially, there is no chance to truncate node blocks again.
I miss something else?

How about this patch?

--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -345,6 +345,7 @@ void f2fs_evict_inode(struct inode *inode)
         set_inode_flag(fi, FI_NO_ALLOC);
         i_size_write(inode, 0);

+retry:
         if (F2FS_HAS_BLOCKS(inode))
                 err = f2fs_truncate(inode, true);

@@ -354,6 +355,11 @@ void f2fs_evict_inode(struct inode *inode)
                 f2fs_unlock_op(sbi);
         }

+       if (err == -ENOMEM) {
+               err = 0;
+               goto retry;
+       }
+
         sb_end_intwrite(inode->i_sb);
  no_delete:
         stat_dec_inline_xattr(inode);
> Signed-off-by: Jaegeuk Kim <jaegeuk@...nel.org>
> ---
>   fs/f2fs/inode.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> index f4ac851..5cccd7a 100644
> --- a/fs/f2fs/inode.c
> +++ b/fs/f2fs/inode.c
> @@ -344,7 +344,7 @@ void f2fs_evict_inode(struct inode *inode)
>   	sb_start_intwrite(inode->i_sb);
>   	set_inode_flag(fi, FI_NO_ALLOC);
>   	i_size_write(inode, 0);
> -
> +retry:
>   	if (F2FS_HAS_BLOCKS(inode))
>   		err = f2fs_truncate(inode, true);
>
> @@ -374,6 +374,11 @@ no_delete:
>
>   	if (err && err != -ENOENT) {
>   		if (!exist_written_data(sbi, inode->i_ino, ORPHAN_INO)) {
> +			/* give more chances, if ENOMEM case */
> +			if (err == -ENOMEM) {
> +				err = 0;
> +				goto retry;
> +			}
>   			/*
>   			 * get here because we failed to release resource
>   			 * of inode previously, reminder our user to run fsck
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ