ocfs2/xattr.c: Fix a bug when inserting xattr.
authorTao Ma <tao.ma@oracle.com>
Fri, 19 Sep 2008 14:16:34 +0000 (22:16 +0800)
committerMark Fasheh <mfasheh@suse.com>
Tue, 14 Oct 2008 00:02:43 +0000 (17:02 -0700)
During the process of xatt insertion, we use binary search
to find the right place and "low" is set to it. But when
there is one xattr which has the same name hash as the inserted
one, low is the wrong value. So set it to the right position.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
fs/ocfs2/xattr.c

index b2e25a828e382846c33a9503c633735aaf53d2a4..b1f2a164e7dce23c707b42e7888ee906308b99c2 100644 (file)
@@ -4003,8 +4003,10 @@ static void ocfs2_xattr_set_entry_normal(struct inode *inode,
                        else if (name_hash <
                                 le32_to_cpu(tmp_xe->xe_name_hash))
                                high = tmp - 1;
-                       else
+                       else {
+                               low = tmp;
                                break;
+                       }
                }
 
                xe = &xh->xh_entries[low];