diff options
author | Jan Kara <jack@suse.cz> | 2016-05-13 04:42:40 (GMT) |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-05-13 04:42:40 (GMT) |
commit | dbc427ce4028580f1244b5b57ca1cbea31aad1e7 (patch) | |
tree | fdd255a0ae575121ae8810eb2f9052b6f8f0c5b3 /fs/ext4/inode.c | |
parent | 7cb476f834d0dc2092e04eeafe9cbe509f6380eb (diff) | |
download | linux-dbc427ce4028580f1244b5b57ca1cbea31aad1e7.tar.xz |
ext4: fix race in transient ENOSPC detection
When there are blocks to free in the running transaction, block
allocator can return ENOSPC although the filesystem has some blocks to
free. We use ext4_should_retry_alloc() to force commit of the current
transaction and return whether anything was committed so that it makes
sense to retry the allocation. However the transaction may get committed
after block allocation fails but before we call
ext4_should_retry_alloc(). So ext4_should_retry_alloc() returns false
because there is nothing to commit and we wrongly return ENOSPC.
Fix the race by unconditionally returning 1 from ext4_should_retry_alloc()
when we tried to commit a transaction. This should not add any
unnecessary retries since we had a transaction running a while ago when
trying to allocate blocks and we want to retry the allocation once that
transaction has committed anyway.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
0 files changed, 0 insertions, 0 deletions