ocfs2-tools/0017-dx_dirs-add-check-for-invalid-slot-in-ocfs2_new_dx_r.patch

31 lines
864 B
Diff

From e618ad9a6cafae5351f87ae0601d3b16ec9af96a Mon Sep 17 00:00:00 2001
From: Mark Fasheh <mfasheh@suse.com>
Date: Mon, 19 Apr 2010 21:36:37 -0700
Subject: [PATCH 17/30] dx_dirs: add check for invalid slot in ocfs2_new_dx_root()
This can happen in the case of a system inode, such as the root or orphan
directories.
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
---
libocfs2/alloc.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/libocfs2/alloc.c b/libocfs2/alloc.c
index 84f3b05..7f85a34 100644
--- a/libocfs2/alloc.c
+++ b/libocfs2/alloc.c
@@ -658,6 +658,9 @@ errcode_t ocfs2_new_dx_root(ocfs2_filesys *fs,
goto out;
slot = di->i_suballoc_slot;
+ if (slot == (uint16_t)OCFS2_INVALID_SLOT)
+ slot = 0;
+
ret = ocfs2_load_allocator(fs, EXTENT_ALLOC_SYSTEM_INODE,
slot, &fs->fs_eb_allocs[slot]);
if (ret)
--
1.7.0.2