Whamcloud - gitweb
LU-2462 e2fsprogs Consider DIRENT_LUFID flag in link_proc(). 37/6237/3
authormsalve <msalve@ddn.com>
Fri, 17 May 2013 13:33:04 +0000 (19:03 +0530)
committermsalve <msalve@ddn.com>
Fri, 17 May 2013 13:33:04 +0000 (19:03 +0530)
While adding the new file entry in directory block, link_proc()
calculates minimum record length of the existing directory entry
without considering the dirent data size and which leads to
corruption. Changed the code to use EXT2_DIR_REC_LEN() which will
return correct record length including dirent data size.

Signed-off-by: Manisha Salve <msalve@ddn.com>
Change-Id: Ic593c558c47a78183143ec8e99d8385ac94d06f7

lib/ext2fs/link.c

index 6ba6451..cc6e7c8 100644 (file)
@@ -69,7 +69,7 @@ static int link_proc(struct ext2_dir_entry *dirent,
         * truncate it and return.
         */
        if (dirent->inode) {
-               min_rec_len = __EXT2_DIR_REC_LEN(dirent->name_len & 0xFF);
+               min_rec_len = EXT2_DIR_REC_LEN((struct ext2_dir_entry_2 *)dirent);
                if (curr_rec_len < (min_rec_len + rec_len))
                        return ret;
                rec_len = curr_rec_len - min_rec_len;