Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Eric Sandeen and committed by
Jan Kara
ea0174a7 799dd75b

+4
+4
fs/ext3/inode.c
··· 1735 1735 ssize_t ret; 1736 1736 int orphan = 0; 1737 1737 size_t count = iov_length(iov, nr_segs); 1738 + int retries = 0; 1738 1739 1739 1740 if (rw == WRITE) { 1740 1741 loff_t final_size = offset + count; ··· 1758 1757 } 1759 1758 } 1760 1759 1760 + retry: 1761 1761 ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, 1762 1762 offset, nr_segs, 1763 1763 ext3_get_block, NULL); 1764 + if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries)) 1765 + goto retry; 1764 1766 1765 1767 if (orphan) { 1766 1768 int err;