vserver 1.9.5.x5
[linux-2.6.git] / fs / ext3 / namei.c
index e7e287e..08f0141 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/quotaops.h>
 #include <linux/buffer_head.h>
 #include <linux/smp_lock.h>
+#include <linux/vserver/xid.h>
 #include "xattr.h"
 #include "acl.h"
 
@@ -610,10 +611,14 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
                de = (struct ext3_dir_entry_2 *) frames[0].bh->b_data;
                if ((err = ext3_htree_store_dirent(dir_file, 0, 0, de)) != 0)
                        goto errout;
+               count++;
+       }
+       if (start_hash < 2 || (start_hash ==2 && start_minor_hash==0)) {
+               de = (struct ext3_dir_entry_2 *) frames[0].bh->b_data;
                de = ext3_next_entry(de);
-               if ((err = ext3_htree_store_dirent(dir_file, 0, 0, de)) != 0)
+               if ((err = ext3_htree_store_dirent(dir_file, 2, 0, de)) != 0)
                        goto errout;
-               count += 2;
+               count++;
        }
 
        while (1) {
@@ -671,6 +676,7 @@ static int dx_make_map (struct ext3_dir_entry_2 *de, int size,
                        map_tail->hash = h.hash;
                        map_tail->offs = (u32) ((char *) de - base);
                        count++;
+                       cond_resched();
                }
                /* XXX: do we need to check rec_len == 0 case? -Chris */
                de = (struct ext3_dir_entry_2 *) ((char *) de + le16_to_cpu(de->rec_len));
@@ -872,7 +878,7 @@ restart:
                if (!buffer_uptodate(bh)) {
                        /* read error, skip block & hope for the best */
                        ext3_error(sb, __FUNCTION__, "reading directory #%lu "
-                                  "offset %lu\n", dir->i_ino, block);
+                                  "offset %lu", dir->i_ino, block);
                        brelse(bh);
                        goto next;
                }
@@ -989,6 +995,7 @@ static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, str
 
                if (!inode)
                        return ERR_PTR(-EACCES);
+               vx_propagate_xid(nd, inode);
        }
        if (inode)
                return d_splice_alias(inode, dentry);
@@ -1251,7 +1258,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
         * happen is that the times are slightly out of date
         * and/or different from the directory change time.
         */
-       dir->i_mtime = dir->i_ctime = CURRENT_TIME;
+       dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
        ext3_update_dx_flag(dir);
        dir->i_version++;
        ext3_mark_inode_dirty(handle, dir);
@@ -2029,7 +2036,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry)
         * recovery. */
        inode->i_size = 0;
        ext3_orphan_add(handle, inode);
-       inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+       inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
        ext3_mark_inode_dirty(handle, inode);
        dir->i_nlink--;
        ext3_update_dx_flag(dir);
@@ -2079,7 +2086,7 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry)
        retval = ext3_delete_entry(handle, dir, de, bh);
        if (retval)
                goto end_unlink;
-       dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+       dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
        ext3_update_dx_flag(dir);
        ext3_mark_inode_dirty(handle, dir);
        inode->i_nlink--;
@@ -2169,7 +2176,7 @@ retry:
        if (IS_DIRSYNC(dir))
                handle->h_sync = 1;
 
-       inode->i_ctime = CURRENT_TIME;
+       inode->i_ctime = CURRENT_TIME_SEC;
        ext3_inc_count(handle, inode);
        atomic_inc(&inode->i_count);
 
@@ -2270,7 +2277,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
         * Like most other Unix systems, set the ctime for inodes on a
         * rename.
         */
-       old_inode->i_ctime = CURRENT_TIME;
+       old_inode->i_ctime = CURRENT_TIME_SEC;
        ext3_mark_inode_dirty(handle, old_inode);
 
        /*
@@ -2303,9 +2310,9 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
 
        if (new_inode) {
                new_inode->i_nlink--;
-               new_inode->i_ctime = CURRENT_TIME;
+               new_inode->i_ctime = CURRENT_TIME_SEC;
        }
-       old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
+       old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
        ext3_update_dx_flag(old_dir);
        if (dir_bh) {
                BUFFER_TRACE(dir_bh, "get_write_access");
@@ -2352,18 +2359,22 @@ struct inode_operations ext3_dir_inode_operations = {
        .mknod          = ext3_mknod,
        .rename         = ext3_rename,
        .setattr        = ext3_setattr,
-       .setxattr       = ext3_setxattr,
-       .getxattr       = ext3_getxattr,
+#ifdef CONFIG_EXT3_FS_XATTR
+       .setxattr       = generic_setxattr,
+       .getxattr       = generic_getxattr,
        .listxattr      = ext3_listxattr,
-       .removexattr    = ext3_removexattr,
+       .removexattr    = generic_removexattr,
+#endif
        .permission     = ext3_permission,
 };
 
 struct inode_operations ext3_special_inode_operations = {
        .setattr        = ext3_setattr,
-       .setxattr       = ext3_setxattr,
-       .getxattr       = ext3_getxattr,
+#ifdef CONFIG_EXT3_FS_XATTR
+       .setxattr       = generic_setxattr,
+       .getxattr       = generic_getxattr,
        .listxattr      = ext3_listxattr,
-       .removexattr    = ext3_removexattr,
+       .removexattr    = generic_removexattr,
+#endif
        .permission     = ext3_permission,
 };