From 4e9958fb4e6e96f2a7367d734da8f4597fc07243 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Mon, 15 Oct 2012 05:06:05 -0400 Subject: [PATCH] LU-2097 quota: more ll_vfs_dq_init() Calls ll_vfs_dq_init() in several places to avoid the missing block accounting for existing inode problem. Signed-off-by: Niu Yawei Change-Id: I1500aa1f75b6a6184d1b40877a69fabdf4fac130 Reviewed-on: http://review.whamcloud.com/4270 Reviewed-by: Johann Lombardi Tested-by: Hudson Reviewed-by: Fan Yong Tested-by: Maloo --- lustre/osd-ldiskfs/osd_compat.c | 2 ++ lustre/osd-ldiskfs/osd_handler.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c index 519357d..b94689c 100644 --- a/lustre/osd-ldiskfs/osd_compat.c +++ b/lustre/osd-ldiskfs/osd_compat.c @@ -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; + ll_vfs_dq_init(dir); 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; + 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); diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 3572bf9..2cf7076 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -1585,6 +1585,7 @@ static int osd_attr_set(const struct lu_env *env, OSD_EXEC_OP(handle, attr_set); inode = obj->oo_inode; + ll_vfs_dq_init(inode); 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; + ll_vfs_dq_init(inode); 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); + ll_vfs_dq_init(inode); 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); + ll_vfs_dq_init(dir); 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; } + LASSERT(pobj->oo_inode); + ll_vfs_dq_init(pobj->oo_inode); rc = osd_ldiskfs_add_entry(oth->ot_handle, child, cinode, hlock); RETURN(rc); -- 1.8.3.1