From: wang di Date: Mon, 17 Mar 2014 18:23:02 +0000 (-0700) Subject: LU-4712 llite: lock the inode to be migrated X-Git-Tag: 2.6.94~20 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=0fab7dc89f4756538f8b67e7736abd6f225abae8 LU-4712 llite: lock the inode to be migrated Because the inode and its connected dentries will be cleared out of the cache after migration, the inode needs to be locked during the migration. Signed-off-by: wang di Change-Id: Ibbbb33473de1a67df85ef8930debcf22cd775bcb Reviewed-on: http://review.whamcloud.com/9689 Tested-by: Jenkins Reviewed-by: Lai Siyao Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 230a41f..0ee0dde 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -3030,11 +3030,14 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, qstr.name = name; qstr.len = namelen; dchild = d_lookup(file->f_dentry, &qstr); - if (dchild != NULL && dchild->d_inode != NULL) { - op_data->op_fid3 = *ll_inode2fid(dchild->d_inode); + if (dchild != NULL) { if (dchild->d_inode != NULL) { child_inode = igrab(dchild->d_inode); - ll_invalidate_aliases(child_inode); + if (child_inode != NULL) { + mutex_lock(&child_inode->i_mutex); + op_data->op_fid3 = *ll_inode2fid(child_inode); + ll_invalidate_aliases(child_inode); + } } dput(dchild); } else { @@ -3075,6 +3078,7 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, out_free: if (child_inode != NULL) { clear_nlink(child_inode); + mutex_unlock(&child_inode->i_mutex); iput(child_inode); }