Whamcloud - gitweb
b=612449
authorpschwan <pschwan>
Sun, 22 Sep 2002 03:32:28 +0000 (03:32 +0000)
committerpschwan <pschwan>
Sun, 22 Sep 2002 03:32:28 +0000 (03:32 +0000)
Fix two bugs related to file attributes:

1. We were accidentally clobbering the mode with the mode from the OST in
   ll_file_size
2. We were not updating the file attributes in ll_find_inode

Both are fixed, and inode attributes are once again coherent.

lustre/include/linux/lustre_lite.h
lustre/llite/file.c
lustre/llite/namei.c
lustre/llite/super.c

index 56a05f9..23912d5 100644 (file)
@@ -2,10 +2,10 @@
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
  * lustre lite cluster file system
- * 
+ *
  * This code is issued under the GNU General Public License.
  * See the file COPYING in this distribution
- * 
+ *
  * Copyright (C) 2002 Cluster File Systems, Inc. <info@clusterfs.com>
  */
 
@@ -62,7 +62,7 @@ struct ll_sb_info {
         struct lustre_handle      ll_mdc_conn;
         struct lustre_handle      ll_osc_conn;
         obd_id                    ll_rootino; /* number of root inode */
-        
+
         int                       ll_flags;
         wait_queue_head_t         ll_commitcbd_waitq;
         wait_queue_head_t         ll_commitcbd_ctl_waitq;
@@ -157,9 +157,12 @@ int ll_file_size(struct inode *inode, struct lov_stripe_md *md);
 
 /* rw.c */
 struct page *ll_getpage(struct inode *inode, unsigned long offset,
-                           int create, int locked);
+                        int create, int locked);
 void ll_truncate(struct inode *inode);
 
+/* super.c */
+void ll_update_inode(struct inode *, struct mds_body *);
+
 /* symlink.c */
 extern struct inode_operations ll_fast_symlink_inode_operations;
 extern struct inode_operations ll_symlink_inode_operations;
index 9183410..44ac03f 100644 (file)
@@ -206,7 +206,7 @@ int ll_file_size(struct inode *inode, struct lov_stripe_md *lsm)
 
         oa.o_id = lsm->lsm_object_id;
         oa.o_mode = S_IFREG;
-        oa.o_valid = OBD_MD_FLID|OBD_MD_FLMODE|OBD_MD_FLSIZE|OBD_MD_FLBLOCKS;
+        oa.o_valid = OBD_MD_FLID|OBD_MD_FLSIZE|OBD_MD_FLBLOCKS;
         rc = obd_getattr(&sbi->ll_osc_conn, &oa, lsm);
         if (!rc)
                 obdo_to_inode(inode, &oa, oa.o_valid);
index ee90f67..f32a6dc 100644 (file)
@@ -87,10 +87,14 @@ static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode)
 static int ll_find_inode(struct inode *inode, unsigned long ino, void *opaque)
 {
         struct ll_read_inode2_cookie *lic = opaque;
+        struct mds_body *body = lic->lic_body;
 
         if (inode->i_generation != lic->lic_body->generation)
                 return 0;
 
+        /* Apply the attributes in 'opaque' to this inode */
+        ll_update_inode(inode, body);
+
         return 1;
 }
 
index 7d63874..ac553f7 100644 (file)
@@ -413,16 +413,8 @@ out:
         RETURN(rc);
 }
 
-static void ll_read_inode2(struct inode *inode, void *opaque)
+void ll_update_inode(struct inode *inode, struct mds_body *body)
 {
-        struct ll_read_inode2_cookie *lic = opaque;
-        struct mds_body *body = lic->lic_body;
-        struct ll_inode_info *lli = ll_i2info(inode);
-        ENTRY;
-
-        sema_init(&lli->lli_open_sem, 1);
-
-        /* core attributes first */
         if (body->valid & OBD_MD_FLID)
                 inode->i_ino = body->ino;
         if (body->valid & OBD_MD_FLATIME)
@@ -447,6 +439,19 @@ static void ll_read_inode2(struct inode *inode, void *opaque)
                 inode->i_rdev = body->extra;
         if (body->valid & OBD_MD_FLSIZE)
                 inode->i_size = body->size;
+}
+
+static void ll_read_inode2(struct inode *inode, void *opaque)
+{
+        struct ll_read_inode2_cookie *lic = opaque;
+        struct mds_body *body = lic->lic_body;
+        struct ll_inode_info *lli = ll_i2info(inode);
+        ENTRY;
+
+        sema_init(&lli->lli_open_sem, 1);
+
+        /* core attributes first */
+        ll_update_inode(inode, body);
 
         //if (body->valid & OBD_MD_FLEASIZE)
         if (lic && lic->lic_lmm) {
@@ -500,8 +505,6 @@ static void ll_read_inode2(struct inode *inode, void *opaque)
                 init_special_inode(inode, inode->i_mode, inode->i_rdev);
                 EXIT;
         }
-
-        return;
 }
 
 /* exported operations */