Commit 8ef9dbe4 authored by wang di's avatar wang di Committed by Greg Kroah-Hartman
Browse files

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: default avatarwang di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4712
Reviewed-on: http://review.whamcloud.com/9689


Reviewed-by: default avatarLai Siyao <lai.siyao@intel.com>
Reviewed-by: default avatarFan Yong <fan.yong@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fee58df6
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -2802,12 +2802,16 @@ 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);
			if (child_inode) {
				inode_lock(child_inode);
				op_data->op_fid3 = *ll_inode2fid(child_inode);
				ll_invalidate_aliases(child_inode);
			}
		}
		dput(dchild);
	} else {
		rc = ll_get_fid_by_name(parent, name, namelen,
@@ -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);
	}