diff options
author | Eric Sandeen <sandeen@redhat.com> | 2009-10-12 22:34:27 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2009-11-11 09:22:49 -0500 |
commit | ea0174a7137c8ca9f130ca681f3a99c872da6778 (patch) | |
tree | 9736ef15e0250810f204bfb8d6987bd71eeba111 /fs/ext3/inode.c | |
parent | 799dd75b1a8380a967c929a4551895788c374b31 (diff) |
ext3: retry failed direct IO allocations
On a 256M 4k block filesystem, doing this in a loop:
dd if=/dev/zero of=test oflag=direct bs=1M count=64
rm -f test
eventually leads to spurious ENOSPC:
dd: writing `test': No space left on device
As with other block allocation callers, it looks like we need to
potentially retry the allocations on the initial ENOSPC.
A similar patch went into ext4 (commit
fbbf69456619de5d251cb9f1df609069178c62d5)
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext3/inode.c')
-rw-r--r-- | fs/ext3/inode.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index acf1b142332..069a163393b 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -1735,6 +1735,7 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb, | |||
1735 | ssize_t ret; | 1735 | ssize_t ret; |
1736 | int orphan = 0; | 1736 | int orphan = 0; |
1737 | size_t count = iov_length(iov, nr_segs); | 1737 | size_t count = iov_length(iov, nr_segs); |
1738 | int retries = 0; | ||
1738 | 1739 | ||
1739 | if (rw == WRITE) { | 1740 | if (rw == WRITE) { |
1740 | loff_t final_size = offset + count; | 1741 | loff_t final_size = offset + count; |
@@ -1757,9 +1758,12 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb, | |||
1757 | } | 1758 | } |
1758 | } | 1759 | } |
1759 | 1760 | ||
1761 | retry: | ||
1760 | ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, | 1762 | ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, |
1761 | offset, nr_segs, | 1763 | offset, nr_segs, |
1762 | ext3_get_block, NULL); | 1764 | ext3_get_block, NULL); |
1765 | if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries)) | ||
1766 | goto retry; | ||
1763 | 1767 | ||
1764 | if (orphan) { | 1768 | if (orphan) { |
1765 | int err; | 1769 | int err; |