Whamcloud - gitweb
- minor fixes trying to get the md right.
authorbraam <braam>
Thu, 22 Aug 2002 18:58:20 +0000 (18:58 +0000)
committerbraam <braam>
Thu, 22 Aug 2002 18:58:20 +0000 (18:58 +0000)
lustre/llite/file.c
lustre/llite/super.c

index da2d2af..23724c6 100644 (file)
@@ -66,6 +66,7 @@ static int ll_file_open(struct inode *inode, struct file *file)
                         oa->o_valid = OBD_MD_FLMODE | OBD_MD_FLEASIZE |
                                         OBD_MD_FLID;
                         rc = obd_create(ll_i2obdconn(inode), oa, &lli->lli_smd);
+
                         if (rc) {
                                 obdo_free(oa);
                                 up(&lli->lli_open_sem);
index fc57730..1d5dd71 100644 (file)
@@ -470,16 +470,6 @@ static void ll_read_inode2(struct inode *inode, void *opaque)
         //if (body->valid & OBD_MD_FLSIZE)
         //        inode->i_size = body->size;
 
-        /* Get the authoritative file size */
-        if (md && md->md && inode->i_mode & S_IFREG) {
-                int rc;
-                rc = ll_file_size(inode, md->md, &inode->i_size);
-                if (rc) {
-                        CERROR("ll_file_size: %d\n", rc);
-                        /* FIXME: need to somehow prevent inode creation */
-                        LBUG();
-                }
-        }
 
         //if (body->valid & OBD_MD_FLEASIZE)
         if (md && md->md && md->md->lmd_stripe_count) { 
@@ -498,6 +488,20 @@ static void ll_read_inode2(struct inode *inode, void *opaque)
                         LBUG();
                 }
                 lov_unpackmd(ii->lli_smd, smd);
+        } else { 
+                ii->lli_smd = NULL;
+        }
+
+        /* Get the authoritative file size */
+        if (ii->lli_smd && (inode->i_mode & S_IFREG)) {
+                int rc;
+
+                rc = ll_file_size(inode, ii->lli_smd, &inode->i_size);
+                if (rc) {
+                        CERROR("ll_file_size: %d\n", rc);
+                        /* FIXME: need to somehow prevent inode creation */
+                        LBUG();
+                }
         }
 
         /* OIDEBUG(inode); */