From: wang di Date: Sun, 18 Sep 2016 20:38:50 +0000 (-0400) Subject: staging: lustre: llite: lock the inode to be migrated X-Git-Tag: v4.9.8~1233^2~392 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ef9dbe4b0ce3d9cae87251184096bfdaff75c9e;p=platform%2Fkernel%2Flinux-rpi3.git staging: lustre: 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 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4712 Reviewed-on: http://review.whamcloud.com/9689 Reviewed-by: Lai Siyao Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index d8761b8..5d4d17f 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -2802,11 +2802,15 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, qstr.name = name; qstr.len = namelen; dchild = d_lookup(file_dentry(file), &qstr); - if (dchild && dchild->d_inode) { + if (dchild) { op_data->op_fid3 = *ll_inode2fid(dchild->d_inode); if (dchild->d_inode) { child_inode = igrab(dchild->d_inode); - ll_invalidate_aliases(child_inode); + if (child_inode) { + inode_lock(child_inode); + op_data->op_fid3 = *ll_inode2fid(child_inode); + ll_invalidate_aliases(child_inode); + } } dput(dchild); } else { @@ -2847,6 +2851,7 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, out_free: if (child_inode) { clear_nlink(child_inode); + inode_unlock(child_inode); iput(child_inode); }