* [PATCH] Ext4: avoid multiple quota reservation when retry block reservation for delalloc
@ 2009-09-21 16:52 Mingming
2009-09-21 18:15 ` Jan Kara
0 siblings, 1 reply; 4+ messages in thread
From: Mingming @ 2009-09-21 16:52 UTC (permalink / raw)
To: Jan Kara, tytso; +Cc: linux-ext4
Ext4: release reserved quota before block reservation for delalloc retry
ext4_da_reserve_space() can reserve quota blocks multiple times if
ext4_claim_free_blocks() fail and we retry the allocation. We should
release the quota reservation before restarting.
Bug found be Jan Kara.
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
---
fs/ext4/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6.31-rc4/fs/ext4/inode.c
===================================================================
--- linux-2.6.31-rc4.orig/fs/ext4/inode.c
+++ linux-2.6.31-rc4/fs/ext4/inode.c
@@ -1785,11 +1785,11 @@ repeat:
if (ext4_claim_free_blocks(sbi, total)) {
spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
+ vfs_dq_release_reservation_block(inode, total);
if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
yield();
goto repeat;
}
- vfs_dq_release_reservation_block(inode, total);
return -ENOSPC;
}
EXT4_I(inode)->i_reserved_data_blocks += nrblocks;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Ext4: avoid multiple quota reservation when retry block reservation for delalloc
2009-09-21 16:52 [PATCH] Ext4: avoid multiple quota reservation when retry block reservation for delalloc Mingming
@ 2009-09-21 18:15 ` Jan Kara
2009-09-21 23:18 ` Mingming
0 siblings, 1 reply; 4+ messages in thread
From: Jan Kara @ 2009-09-21 18:15 UTC (permalink / raw)
To: Mingming; +Cc: linux-ext4, tytso
On Mon 21-09-09 09:52:30, Mingming wrote:
> Ext4: release reserved quota before block reservation for delalloc retry
>
> ext4_da_reserve_space() can reserve quota blocks multiple times if
> ext4_claim_free_blocks() fail and we retry the allocation. We should
> release the quota reservation before restarting.
>
> Bug found be Jan Kara.
^^ by
>
> Signed-off-by: Mingming Cao <cmm@us.ibm.com>
>
> ---
> fs/ext4/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-2.6.31-rc4/fs/ext4/inode.c
> ===================================================================
> --- linux-2.6.31-rc4.orig/fs/ext4/inode.c
> +++ linux-2.6.31-rc4/fs/ext4/inode.c
> @@ -1785,11 +1785,11 @@ repeat:
>
> if (ext4_claim_free_blocks(sbi, total)) {
> spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
> + vfs_dq_release_reservation_block(inode, total);
> if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
> yield();
> goto repeat;
> }
> - vfs_dq_release_reservation_block(inode, total);
> return -ENOSPC;
> }
> EXT4_I(inode)->i_reserved_data_blocks += nrblocks;
>
The patch is fine. Acked-by: Jan Kara <jack@suse.cz>
But it's certainly not the issue hit by Pavol but I'm out of ideas where
could be a problem provided he runs with extents...
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Ext4: avoid multiple quota reservation when retry block reservation for delalloc
2009-09-21 18:15 ` Jan Kara
@ 2009-09-21 23:18 ` Mingming
2009-09-28 14:49 ` Theodore Tso
0 siblings, 1 reply; 4+ messages in thread
From: Mingming @ 2009-09-21 23:18 UTC (permalink / raw)
To: Jan Kara; +Cc: linux-ext4, tytso
[-- Attachment #1: Type: text/plain, Size: 1689 bytes --]
On Mon, 2009-09-21 at 20:15 +0200, Jan Kara wrote:
> On Mon 21-09-09 09:52:30, Mingming wrote:
> > Ext4: release reserved quota before block reservation for delalloc retry
> >
> > ext4_da_reserve_space() can reserve quota blocks multiple times if
> > ext4_claim_free_blocks() fail and we retry the allocation. We should
> > release the quota reservation before restarting.
> >
> > Bug found be Jan Kara.
> ^^ by
attached is the updated patch with this typo fixed.
> >
> > Signed-off-by: Mingming Cao <cmm@us.ibm.com>
> >
> > ---
> > fs/ext4/inode.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Index: linux-2.6.31-rc4/fs/ext4/inode.c
> > ===================================================================
> > --- linux-2.6.31-rc4.orig/fs/ext4/inode.c
> > +++ linux-2.6.31-rc4/fs/ext4/inode.c
> > @@ -1785,11 +1785,11 @@ repeat:
> >
> > if (ext4_claim_free_blocks(sbi, total)) {
> > spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
> > + vfs_dq_release_reservation_block(inode, total);
> > if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
> > yield();
> > goto repeat;
> > }
> > - vfs_dq_release_reservation_block(inode, total);
> > return -ENOSPC;
> > }
> > EXT4_I(inode)->i_reserved_data_blocks += nrblocks;
> >
> The patch is fine. Acked-by: Jan Kara <jack@suse.cz>
Thanks!
> But it's certainly not the issue hit by Pavol but I'm out of ideas where
> could be a problem provided he runs with extents...
>
I am not sure where is the problem reported by Pavol by looking at the
code either. Perhaps enable some debugging code, but I am under
impression that the system is in-use now...
Mingming
[-- Attachment #2: quota-dealloc-fix.patch --]
[-- Type: text/x-patch, Size: 1000 bytes --]
Ext4: release reserved quota when block reservation for delalloc retry
ext4_da_reserve_space() can reserve quota blocks multiple times if
ext4_claim_free_blocks() fail and we retry the allocation. We should
release the quota reservation before restarting.
Bug found by Jan Kara.
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
---
fs/ext4/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6.31-rc4/fs/ext4/inode.c
===================================================================
--- linux-2.6.31-rc4.orig/fs/ext4/inode.c
+++ linux-2.6.31-rc4/fs/ext4/inode.c
@@ -1785,11 +1785,11 @@ repeat:
if (ext4_claim_free_blocks(sbi, total)) {
spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
+ vfs_dq_release_reservation_block(inode, total);
if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
yield();
goto repeat;
}
- vfs_dq_release_reservation_block(inode, total);
return -ENOSPC;
}
EXT4_I(inode)->i_reserved_data_blocks += nrblocks;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Ext4: avoid multiple quota reservation when retry block reservation for delalloc
2009-09-21 23:18 ` Mingming
@ 2009-09-28 14:49 ` Theodore Tso
0 siblings, 0 replies; 4+ messages in thread
From: Theodore Tso @ 2009-09-28 14:49 UTC (permalink / raw)
To: Mingming; +Cc: Jan Kara, linux-ext4
On Mon, Sep 21, 2009 at 04:18:02PM -0700, Mingming wrote:
> On Mon, 2009-09-21 at 20:15 +0200, Jan Kara wrote:
> > On Mon 21-09-09 09:52:30, Mingming wrote:
> > > Ext4: release reserved quota before block reservation for delalloc retry
> > >
> > > ext4_da_reserve_space() can reserve quota blocks multiple times if
> > > ext4_claim_free_blocks() fail and we retry the allocation. We should
> > > release the quota reservation before restarting.
> > >
> > > Bug found be Jan Kara.
> > ^^ by
>
> attached is the updated patch with this typo fixed.
Added to the ext4 patch queue, thanks.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-09-28 14:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-21 16:52 [PATCH] Ext4: avoid multiple quota reservation when retry block reservation for delalloc Mingming
2009-09-21 18:15 ` Jan Kara
2009-09-21 23:18 ` Mingming
2009-09-28 14:49 ` Theodore Tso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).