Whamcloud - gitweb
LU-2097 quota: more ll_vfs_dq_init()
authorNiu Yawei <niu@whamcloud.com>
Mon, 15 Oct 2012 09:06:05 +0000 (05:06 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 15 Oct 2012 19:27:58 +0000 (15:27 -0400)
Calls ll_vfs_dq_init() in several places to avoid the missing
block accounting for existing inode problem.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: I1500aa1f75b6a6184d1b40877a69fabdf4fac130
Reviewed-on: http://review.whamcloud.com/4270
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Tested-by: Hudson
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/osd-ldiskfs/osd_compat.c
lustre/osd-ldiskfs/osd_handler.c

index 519357d..b94689c 100644 (file)
@@ -314,6 +314,7 @@ int osd_compat_del_entry(struct osd_thread_info *info, struct osd_device *osd,
         child->d_parent = dird;
         child->d_inode = NULL;
 
         child->d_parent = dird;
         child->d_inode = NULL;
 
+       ll_vfs_dq_init(dir);
        mutex_lock(&dir->i_mutex);
        rc = -ENOENT;
        bh = osd_ldiskfs_find_entry(dir, child, &de, NULL);
        mutex_lock(&dir->i_mutex);
        rc = -ENOENT;
        bh = osd_ldiskfs_find_entry(dir, child, &de, NULL);
@@ -352,6 +353,7 @@ int osd_compat_add_entry(struct osd_thread_info *info, struct osd_device *osd,
         child->d_parent = dir;
         child->d_inode = inode;
 
         child->d_parent = dir;
         child->d_inode = inode;
 
+       ll_vfs_dq_init(dir->d_inode);
        mutex_lock(&dir->d_inode->i_mutex);
        rc = osd_ldiskfs_add_entry(oh->ot_handle, child, inode, NULL);
        mutex_unlock(&dir->d_inode->i_mutex);
        mutex_lock(&dir->d_inode->i_mutex);
        rc = osd_ldiskfs_add_entry(oh->ot_handle, child, inode, NULL);
        mutex_unlock(&dir->d_inode->i_mutex);
index 3572bf9..2cf7076 100644 (file)
@@ -1585,6 +1585,7 @@ static int osd_attr_set(const struct lu_env *env,
         OSD_EXEC_OP(handle, attr_set);
 
         inode = obj->oo_inode;
         OSD_EXEC_OP(handle, attr_set);
 
         inode = obj->oo_inode;
+       ll_vfs_dq_init(inode);
 
        rc = osd_quota_transfer(inode, attr);
        if (rc)
 
        rc = osd_quota_transfer(inode, attr);
        if (rc)
@@ -2103,6 +2104,7 @@ static int __osd_xattr_set(const struct lu_env *env, struct dt_object *dt,
         if (fl & LU_XATTR_CREATE)
                 fs_flags |= XATTR_CREATE;
 
         if (fl & LU_XATTR_CREATE)
                 fs_flags |= XATTR_CREATE;
 
+       ll_vfs_dq_init(inode);
         dentry->d_inode = inode;
         rc = inode->i_op->setxattr(dentry, name, buf->lb_buf,
                                    buf->lb_len, fs_flags);
         dentry->d_inode = inode;
         rc = inode->i_op->setxattr(dentry, name, buf->lb_buf,
                                    buf->lb_len, fs_flags);
@@ -2503,6 +2505,7 @@ static int osd_xattr_del(const struct lu_env *env, struct dt_object *dt,
 
         OSD_EXEC_OP(handle, xattr_set);
 
 
         OSD_EXEC_OP(handle, xattr_set);
 
+       ll_vfs_dq_init(inode);
         dentry->d_inode = inode;
         rc = inode->i_op->removexattr(dentry, name);
         return rc;
         dentry->d_inode = inode;
         rc = inode->i_op->removexattr(dentry, name);
         return rc;
@@ -2988,6 +2991,7 @@ static int osd_index_ea_delete(const struct lu_env *env, struct dt_object *dt,
         if (osd_object_auth(env, dt, capa, CAPA_OPC_INDEX_DELETE))
                 RETURN(-EACCES);
 
         if (osd_object_auth(env, dt, capa, CAPA_OPC_INDEX_DELETE))
                 RETURN(-EACCES);
 
+       ll_vfs_dq_init(dir);
         dentry = osd_child_dentry_get(env, obj,
                                       (char *)key, strlen((char *)key));
 
         dentry = osd_child_dentry_get(env, obj,
                                       (char *)key, strlen((char *)key));
 
@@ -3207,6 +3211,8 @@ static int __osd_ea_add_rec(struct osd_thread_info *info,
         } else {
                 child->d_fsdata = NULL;
         }
         } else {
                 child->d_fsdata = NULL;
         }
+       LASSERT(pobj->oo_inode);
+       ll_vfs_dq_init(pobj->oo_inode);
         rc = osd_ldiskfs_add_entry(oth->ot_handle, child, cinode, hlock);
 
         RETURN(rc);
         rc = osd_ldiskfs_add_entry(oth->ot_handle, child, cinode, hlock);
 
         RETURN(rc);