Whamcloud - gitweb
- making inode create and assigning the fid to it atomicaly
authoryury <yury>
Mon, 22 May 2006 13:08:50 +0000 (13:08 +0000)
committeryury <yury>
Mon, 22 May 2006 13:08:50 +0000 (13:08 +0000)
lustre/llite/llite_lib.c
lustre/llite/namei.c

index b37cc06..d2103f1 100644 (file)
@@ -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,
index 7a0e982..5b67cb4 100644 (file)
@@ -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);