From: yury Date: Mon, 22 May 2006 13:08:50 +0000 (+0000) Subject: - making inode create and assigning the fid to it atomicaly X-Git-Tag: v1_8_0_110~486^2~1783 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=6a12507091da94a10c4dcae066601efe8e412ebb;p=fs%2Flustre-release.git - making inode create and assigning the fid to it atomicaly --- diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index b37cc06..d2103f1 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -339,8 +339,6 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) GOTO(out_root, err = -EBADF); } - ll_i2info(root)->lli_fid = sbi->ll_root_fid; - err = ll_close_thread_start(&sbi->ll_lcq); if (err) { CERROR("cannot start close thread: rc %d\n", err); @@ -1586,7 +1584,6 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req, CERROR("new_inode -fatal: rc %d\n", rc); GOTO(out, rc); } - ll_i2info(*inode)->lli_fid = md.body->fid1; } rc = obd_checkmd(sbi->ll_dt_exp, sbi->ll_md_exp, diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 7a0e982..5b67cb4 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -62,15 +62,20 @@ int ll_set_inode(struct inode *inode, void *opaque) struct inode *ll_iget(struct super_block *sb, ino_t hash, struct lustre_md *md) { + struct ll_inode_info *lli; struct inode *inode; LASSERT(hash != 0); inode = iget_locked(sb, hash); if (inode) { if (inode->i_state & I_NEW) { + lli = ll_i2info(inode); ll_read_inode2(inode, md); + lli->lli_fid = md->body->fid1; unlock_new_inode(inode); } else { + /* inode is not new, no chamges to fid + * should take place. */ ll_update_inode(inode, md); } CDEBUG(D_VFSTRACE, "inode: %lu/%u(%p)\n", @@ -88,8 +93,12 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash, inode = iget4(sb, hash, NULL, md); if (inode) { - if (!(inode->i_state & (I_FREEING | I_CLEAR))) + if (!(inode->i_state & (I_FREEING | I_CLEAR))) { ll_update_inode(inode, md); + down(&inode->i_sem); + lli->lli_fid = md->body->fid1; + up(&inode->i_sem); + } CDEBUG(D_VFSTRACE, "inode: %lu/%u(%p)\n", inode->i_ino, inode->i_generation, inode);