summaryrefslogtreecommitdiff
path: root/tests/fs-tests/integrity
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-18 14:01:00 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-04-22 14:29:52 +0300
commit6c9452e6985d144d000a97e390cd430a13cae501 (patch)
tree0cfbd93ed5936e17f08ebfb928feddd0bf28e67d /tests/fs-tests/integrity
parentf32557ae4c456aca95b237023fae08998a72db4d (diff)
fs-tests: integck: make rename_entry return error on failure
Make 'rename_entry()' return an error to the caller when it fails to rename a directory entry. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'tests/fs-tests/integrity')
-rw-r--r--tests/fs-tests/integrity/integck.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index 09b4a7d..f56ff66 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -1664,7 +1664,7 @@ static char *pick_rename_name(struct dir_info **parent,
return dup_string(entry->name);
}
-static void rename_entry(struct dir_entry_info *entry)
+static int rename_entry(struct dir_entry_info *entry)
{
struct dir_entry_info *rename_entry = NULL;
struct dir_info *parent;
@@ -1672,7 +1672,7 @@ static void rename_entry(struct dir_entry_info *entry)
int ret, isdir, retry;
if (!entry->parent)
- return;
+ return 0;
for (retry = 0; retry < 3; retry++) {
path = dir_path(entry->parent, entry->name);
@@ -1701,17 +1701,21 @@ static void rename_entry(struct dir_entry_info *entry)
}
if (!path)
- return;
+ return 0;
ret = rename(path, to);
if (ret != 0) {
+ ret = 0;
if (errno == ENOSPC)
full = 1;
- CHECK(errno == ENOSPC || errno == EBUSY);
+ else if (errno != EBUSY) {
+ pcv("failed to rename %s to %s", path, to);
+ ret = -1;
+ }
free(path);
free(name);
free(to);
- return;
+ return ret;
}
free(path);
@@ -1720,7 +1724,7 @@ static void rename_entry(struct dir_entry_info *entry)
if (rename_entry && rename_entry->type == entry->type &&
rename_entry->target == entry->target) {
free(name);
- return;
+ return 0;
}
add_dir_entry(parent, entry->type, name, entry->target);
@@ -1728,6 +1732,7 @@ static void rename_entry(struct dir_entry_info *entry)
remove_dir_entry(rename_entry);
remove_dir_entry(entry);
free(name);
+ return 0;
}
static size_t str_count(const char *s, char c)
@@ -1904,10 +1909,8 @@ static void operate_on_file(struct file_info *file)
static int operate_on_entry(struct dir_entry_info *entry)
{
/* 1 time in 1000 rename */
- if (random_no(1000) == 0) {
- rename_entry(entry);
- return 0;
- }
+ if (random_no(1000) == 0)
+ return rename_entry(entry);
if (entry->type == 's') {
symlink_check(entry->symlink);
/* If shrinking, 1 time in 50, remove a symlink */