aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2009-10-02 21:20:55 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-14 08:07:14 -0800
commit620c66ab00f5b06de7119fbe0cc7dba3cc9aca7d (patch)
treed55c301a6e0d7dac7620ad602849b0f41284314a /fs
parent2489f42e40972d65e50a0b842297f90ce02e6cb0 (diff)
ext4: retry failed direct IO allocations
(cherry picked from commit fbbf69456619de5d251cb9f1df609069178c62d5) On a 256M filesystem, doing this in a loop: xfs_io -F -f -d -c 'pwrite 0 64m' test rm -f test eventually leads to ENOSPC. (the xfs_io command does a 64m direct IO write to the file "test") As with other block allocation callers, it looks like we need to potentially retry the allocations on the initial ENOSPC. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/inode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index aac46d0000af..6c8411bb0513 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3372,6 +3372,7 @@ static ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb,
ssize_t ret;
int orphan = 0;
size_t count = iov_length(iov, nr_segs);
+ int retries = 0;
if (rw == WRITE) {
loff_t final_size = offset + count;
@@ -3394,9 +3395,12 @@ static ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb,
}
}
+retry:
ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
offset, nr_segs,
ext4_get_block, NULL);
+ if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
+ goto retry;
if (orphan) {
int err;