async_rpc_send_reply(req, &result);
return;
}
- g_mutex_lock(dir1->lock);
- encode_pre_wcc(wcc1, dir1);
BlueSkyInode *dir2 = lookup_fh(req, &argp->to.dir);
if (dir2 == NULL) {
result.status = NFS3ERR_STALE;
- g_mutex_unlock(dir1->lock);
async_rpc_send_reply(req, &result);
return;
}
- g_mutex_lock(dir2->lock);
+
+ if (dir1->inum < dir2->inum) {
+ g_mutex_lock(dir1->lock);
+ g_mutex_lock(dir2->lock);
+ } else if (dir1->inum > dir2->inum) {
+ g_mutex_lock(dir2->lock);
+ g_mutex_lock(dir1->lock);
+ }
+ encode_pre_wcc(wcc1, dir1);
encode_pre_wcc(wcc2, dir1);
gboolean status = bluesky_rename(dir1, argp->from.name,
else
result.status = NFS3ERR_PERM;
- g_mutex_unlock(dir2->lock);
g_mutex_unlock(dir1->lock);
+ if (dir1->inum != dir2->inum)
+ g_mutex_unlock(dir2->lock);
async_rpc_send_reply(req, &result);
}