From f1af79618bd47cafabecb363b2c98e7847a23470 Mon Sep 17 00:00:00 2001 From: pschwan Date: Thu, 31 Oct 2002 15:22:33 +0000 Subject: [PATCH] many places in the reint path did not use generation numbers with their locks; fixed. --- lustre/mds/handler.c | 3 +++ lustre/mds/mds_reint.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index dbd74bf..be6cd27 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -161,6 +161,7 @@ struct dentry *mds_name2locked_dentry(struct obd_device *obd, RETURN(dchild); res_id[0] = dchild->d_inode->i_ino; + res_id[1] = dchild->d_inode->i_generation; rc = ldlm_match_or_enqueue(NULL, NULL, obd->obd_namespace, NULL, res_id, LDLM_PLAIN, NULL, 0, lock_mode, &flags, ldlm_completion_ast, @@ -188,6 +189,7 @@ struct dentry *mds_fid2locked_dentry(struct obd_device *obd, struct ll_fid *fid, RETURN(de); res_id[0] = de->d_inode->i_ino; + res_id[1] = de->d_inode->i_generation; rc = ldlm_match_or_enqueue(NULL, NULL, obd->obd_namespace, NULL, res_id, LDLM_PLAIN, NULL, 0, lock_mode, &flags, ldlm_completion_ast, @@ -614,6 +616,7 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req) lock_mode = (req->rq_reqmsg->opc == MDS_REINT) ? LCK_CW : LCK_PW; res_id[0] = dir->i_ino; + res_id[1] = dir->i_generation; rc = ldlm_lock_match(obd->obd_namespace, res_id, LDLM_PLAIN, NULL, 0, lock_mode, &lockh); diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index 45cd424..4e670ca 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -526,6 +526,7 @@ static int mds_reint_link(struct mds_update_record *rec, int offset, /* plan to change the link count on this inode: write lock */ lock_mode = (req->rq_reqmsg->opc == MDS_REINT) ? LCK_PW : LCK_PW; res_id[0] = de_src->d_inode->i_ino; + res_id[1] = de_src->d_inode->i_generation; rc = ldlm_lock_match(obd->obd_namespace, res_id, LDLM_PLAIN, NULL, 0, lock_mode, &srclockh); @@ -549,6 +550,7 @@ static int mds_reint_link(struct mds_update_record *rec, int offset, lock_mode = (req->rq_reqmsg->opc == MDS_REINT) ? LCK_PW : LCK_PW; res_id[0] = de_tgt_dir->d_inode->i_ino; + res_id[1] = de_tgt_dir->d_inode->i_generation; rc = ldlm_lock_match(obd->obd_namespace, res_id, LDLM_PLAIN, NULL, 0, lock_mode, &tgtlockh); @@ -666,6 +668,7 @@ static int mds_reint_rename(struct mds_update_record *rec, int offset, lock_mode = (req->rq_reqmsg->opc == MDS_REINT) ? LCK_PW : LCK_PW; res_id[0] = de_srcdir->d_inode->i_ino; + res_id[1] = de_srcdir->d_inode->i_generation; rc = ldlm_lock_match(obd->obd_namespace, res_id, LDLM_PLAIN, NULL, 0, lock_mode, &srclockh); @@ -688,6 +691,7 @@ static int mds_reint_rename(struct mds_update_record *rec, int offset, lock_mode = (req->rq_reqmsg->opc == MDS_REINT) ? LCK_PW : LCK_PW; res_id[0] = de_tgtdir->d_inode->i_ino; + res_id[1] = de_tgtdir->d_inode->i_generation; rc = ldlm_lock_match(obd->obd_namespace, res_id, LDLM_PLAIN, NULL, 0, lock_mode, &tgtlockh); @@ -774,6 +778,7 @@ out_rename_denew: out_rename_deold: if (!rc) { res_id[0] = de_old->d_inode->i_ino; + res_id[1] = de_old->d_inode->i_generation; flags = 0; /* Take an exclusive lock on the resource that we're * about to free, to force everyone to drop their -- 1.8.3.1