Linux-ext4 Archive on lore.kernel.org
 help / color / Atom feed
From: Ritesh Harjani <riteshh@linux.ibm.com>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org, "Theodore Ts'o" <tytso@mit.edu>,
	linux-kernel@vger.kernel.org
Cc: Dmitry Monakhov <dmtrmonakhov@yandex-team.ru>,
	Eric Whitney <enwlinux@gmail.com>
Subject: Re: [PATCH] ext4: deaccount delayed allocations at freeing inode in ext4_evict_inode()
Date: Fri, 8 Nov 2019 07:38:26 +0530
Message-ID: <20191108020827.15D1EAE056@d06av26.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <157233344808.4027.17162642259754563372.stgit@buzz>



On 10/29/19 12:47 PM, Konstantin Khlebnikov wrote:
> If inode->i_blocks is zero then ext4_evict_inode() skips ext4_truncate().
> Delayed allocation extents are freed later in ext4_clear_inode() but this
> happens when quota reference is already dropped. This leads to leak of
> reserved space in quota block, which disappears after umount-mount.
> 
> This seems broken for a long time but worked somehow until recent changes
> in delayed allocation.

Sorry, I may have missed it, but could you please help understand
what recent changes in delayed allocation make this break or worse?


A silly query, since I couldn't figure it out. Maybe the code has been
there ever since like this:-
So why can't we just move drop_dquot later after the 
ext4_es_remove_extent() (in function ext4_clear_inode)? Any known
problems around that?

-ritesh


> 
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> ---
>   fs/ext4/inode.c |    9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 516faa280ced..580898145e8f 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -293,6 +293,15 @@ void ext4_evict_inode(struct inode *inode)
>   				   inode->i_ino, err);
>   			goto stop_handle;
>   		}
> +	} else if (EXT4_I(inode)->i_reserved_data_blocks) {
> +		/* Deaccount reserve if inode has only delayed allocations. */
> +		err = ext4_es_remove_extent(inode, 0, EXT_MAX_BLOCKS);
> +		if (err) {
> +			ext4_warning(inode->i_sb,
> +				     "couldn't remove extents %lu (err %d)",
> +				     inode->i_ino, err);
> +			goto stop_handle;
> +		}
>   	}
> 
>   	/* Remove xattr references. */
> 


  parent reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-29  7:17 Konstantin Khlebnikov
2019-10-29  7:20 ` Konstantin Khlebnikov
2019-11-07 17:58 ` Konstantin Khlebnikov
2019-11-08  2:08 ` Ritesh Harjani [this message]
2019-11-08  8:30   ` Konstantin Khlebnikov
2019-11-08 11:54     ` Jan Kara
2019-11-15  0:27       ` Theodore Y. Ts'o

Reply instructions:

You may reply publically 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=20191108020827.15D1EAE056@d06av26.portsmouth.uk.ibm.com \
    --to=riteshh@linux.ibm.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=dmtrmonakhov@yandex-team.ru \
    --cc=enwlinux@gmail.com \
    --cc=khlebnikov@yandex-team.ru \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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

Linux-ext4 Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-ext4/0 linux-ext4/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-ext4 linux-ext4/ https://lore.kernel.org/linux-ext4 \
		linux-ext4@vger.kernel.org
	public-inbox-index linux-ext4

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-ext4


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git