Merge branch 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[cascardo/linux.git] / fs / ext4 / namei.c
index ddc309e..a73a919 100644 (file)
@@ -639,7 +639,7 @@ static struct stats dx_show_leaf(struct inode *dir,
                                        res = fscrypt_fname_alloc_buffer(
                                                dir, len,
                                                &fname_crypto_str);
-                                       if (res < 0)
+                                       if (res)
                                                printk(KERN_WARNING "Error "
                                                        "allocating crypto "
                                                        "buffer--skipping "
@@ -647,7 +647,7 @@ static struct stats dx_show_leaf(struct inode *dir,
                                        res = fscrypt_fname_disk_to_usr(dir,
                                                0, 0, &de_name,
                                                &fname_crypto_str);
-                                       if (res < 0) {
+                                       if (res) {
                                                printk(KERN_WARNING "Error "
                                                        "converting filename "
                                                        "from disk to usr"
@@ -1011,7 +1011,7 @@ static int htree_dirblock_to_tree(struct file *dir_file,
                        err = fscrypt_fname_disk_to_usr(dir, hinfo->hash,
                                        hinfo->minor_hash, &de_name,
                                        &fname_crypto_str);
-                       if (err < 0) {
+                       if (err) {
                                count = err;
                                goto errout;
                        }
@@ -2044,33 +2044,31 @@ static int make_indexed_dir(handle_t *handle, struct ext4_filename *fname,
        frame->entries = entries;
        frame->at = entries;
        frame->bh = bh;
-       bh = bh2;
 
        retval = ext4_handle_dirty_dx_node(handle, dir, frame->bh);
        if (retval)
                goto out_frames;        
-       retval = ext4_handle_dirty_dirent_node(handle, dir, bh);
+       retval = ext4_handle_dirty_dirent_node(handle, dir, bh2);
        if (retval)
                goto out_frames;        
 
-       de = do_split(handle,dir, &bh, frame, &fname->hinfo);
+       de = do_split(handle,dir, &bh2, frame, &fname->hinfo);
        if (IS_ERR(de)) {
                retval = PTR_ERR(de);
                goto out_frames;
        }
-       dx_release(frames);
 
-       retval = add_dirent_to_buf(handle, fname, dir, inode, de, bh);
-       brelse(bh);
-       return retval;
+       retval = add_dirent_to_buf(handle, fname, dir, inode, de, bh2);
 out_frames:
        /*
         * Even if the block split failed, we have to properly write
         * out all the changes we did so far. Otherwise we can end up
         * with corrupted filesystem.
         */
-       ext4_mark_inode_dirty(handle, dir);
+       if (retval)
+               ext4_mark_inode_dirty(handle, dir);
        dx_release(frames);
+       brelse(bh2);
        return retval;
 }
 
@@ -3144,7 +3142,7 @@ static int ext4_symlink(struct inode *dir,
                istr.name = (const unsigned char *) symname;
                istr.len = len;
                err = fscrypt_fname_usr_to_disk(inode, &istr, &ostr);
-               if (err < 0)
+               if (err)
                        goto err_drop_inode;
                sd->len = cpu_to_le16(ostr.len);
                disk_link.name = (char *) sd;