summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2010-11-25 17:37:35 +0000
committerRichard W.M. Jones <rjones@redhat.com>2010-11-25 17:39:08 +0000
commitcf29103041581a1d71444f978ad4f6ad69b63033 (patch)
tree7728cc27e8110c0a7290a806a98a8c6ae1b0fb0c
parent2cfee8d4762ffa1ec2566e8c5e94d790c62c5b30 (diff)
downloadfebootstrap-cf29103041581a1d71444f978ad4f6ad69b63033.tar.gz
febootstrap-cf29103041581a1d71444f978ad4f6ad69b63033.tar.xz
febootstrap-cf29103041581a1d71444f978ad4f6ad69b63033.zip
ext2: Fix "ext2fs_mkdir .. No free space in directory".
We weren't expanding ext2 directories and as a result we could hit a limit when the directory grows larger than one block. Note that this fix only applies for creating subdirectories. For creating files (ie. ext2fs_link) we were already doing the right thing.
-rw-r--r--helper/ext2.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/helper/ext2.c b/helper/ext2.c
index 7ad120b..2fc8036 100644
--- a/helper/ext2.c
+++ b/helper/ext2.c
@@ -135,10 +135,20 @@ ext2_mkdir (ext2_ino_t dir_ino, const char *dirname, const char *basename,
if (err != 0)
error (EXIT_FAILURE, 0, "ext2fs_new_inode: %s", error_message (err));
+ try_again:
err = ext2fs_mkdir (fs, dir_ino, ino, basename);
- if (err != 0)
- error (EXIT_FAILURE, 0, "ext2fs_mkdir: %s/%s: %s",
- dirname, basename, error_message (err));
+ if (err != 0) {
+ /* See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=217892 */
+ if (err == EXT2_ET_DIR_NO_SPACE) {
+ err = ext2fs_expand_dir (fs, dir_ino);
+ if (err)
+ error (EXIT_FAILURE, 0, "ext2fs_expand_dir: %s/%s: %s",
+ dirname, basename, error_message (err));
+ goto try_again;
+ } else
+ error (EXIT_FAILURE, 0, "ext2fs_mkdir: %s/%s: %s",
+ dirname, basename, error_message (err));
+ }
/* Copy the final permissions, UID etc. to the inode. */
struct ext2_inode inode;